golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.07k stars 17.68k forks source link

cmd/go: test mixes stderr and stdout #25241

Open andreimatei opened 6 years ago

andreimatei commented 6 years ago

https://github.com/golang/go/commit/7badae85f20f1bce4cc344f9202447618d45d414 appears to have made go test mix stderr and stdout from tests, which has made go 1.10 a regression for CockroachDB's benchmarks. This issue is related to https://github.com/golang/go/issues/18010 : Not only is the benchmark output not swallowed, but stderr and stdout are now mixed, so, if our binary produces logs (on stderr, as ours does), it's now impossible to see the benchmark results or use tools like benchstat. In particular, I believe benchstat fails to work because the mixing of stderr and stdout doesn't even use line buffering - so the benchmark measurements lines are mixed with log lines and benchstat can't recognize them any more.

I generally concur with the folks on #18010 arguing that the swallowing/not swallowing of output is inconsistent (and there's no control over it as far as I can tell). Additionally, now the mixing of stdout and stderr is really a problem. The argument for not doing anything about go test -bench not swallowing output was that "we should at least preserve existing behavior as much as possible", but it would appear that existing behavior was changed in a quite significant way by this mixing. So I would kindly ask for the swallowing decision to be re-evaluated.

What version of Go are you using (go version)?

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

OS X/ amd64

cc @benesch

odeke-em commented 6 years ago

/cc @bradfitz and @rsc

zamsden commented 6 years ago

This is horrible and next to unusable. Users should be able to opt-in to getting this output, not forced in.

rsc commented 6 years ago

I'm sorry your benchmarks print so much to standard error. They might give more reliable timing results if they didn't do that, parsing aside. "Horrible and next to unusable" strikes me as a bit of an exaggeration. As far as I can tell only CockroachDB is running into this.

I'm sorry we didn't get to it in Go 1.11.

bcmills commented 5 years ago

24929 may also affect this behavior.