Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: Benchmark prints nothing on failure #32066

rogpeppe opened this issue May 15, 2019 · 1 comment


Copy link

commented May 15, 2019

Benchmark functions can call Log, Error and Fatal, but if the benchmark is run with the Benchmark function, all messages are discarded.

Perhaps the messages should be printed to standard error?

@josharian josharian changed the title Benchmark prints nothing on failure testing: Benchmark prints nothing on failure May 15, 2019

@FiloSottile FiloSottile added this to the Go1.14 milestone May 16, 2019


This comment has been minimized.

Copy link

commented May 20, 2019

Hi, I can confirm that the output is discarded, here is the writer used in the context of the benchmark

w: discard{},

Calls from Log, Error, or Fatal will print nothing, because the Write call of the discard writer does nothing.


Lines 783 to 785 in fbc6a97

type discard struct{}
func (discard) Write(b []byte) (n int, err error) { return len(b), nil }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.