When we run go build -x, we send a bunch of extra logging to os.Stderr. That's fine in production code, but it makes unit-testing unpleasant: if tests run in parallel with cfg.BuildX set to true, the logging from the tests ends up all jumbled together.
We're already threading through a context.Context argument to many functions for tracing (see cmd/go.maybeStartTrace). We should also use that argument for output streams in order to better isolate tests.