Go: cmd/go: test should print the failure cases to stderr

Created on 20 Sep 2017  路  3Comments  路  Source: golang/go

The go test output is quite noisy when -v is set. It would be great to be able to differentiate the failed cases and their details.

One differentiator would be writing the failure details to the stderr, then the tools can colorize or filter the stderr to highlight the failures:

stderrtest

/cc @rsc @ianlancetaylor

FrozenDueToAge

Most helpful comment

I will write a tool to consume the go test output instead, thanks for the input.

All 3 comments

Some way to colorize sounds good to me, but mixing stdout/stderr doesn't seem like the right approach. I think there will be too many scenarios in which the output gets out of sync.

Writing to stderr is not right. Like Ian said, it's too easy to get stdout and stderr out of sync that way. They're not for fine-grained interleaving of the same output. Here there's just one output stream so it all goes to one output. (The canonical case for stdout/stderr would be something like cat, where the output goes to stdout but errors about not being able to open or read input files go to stderr.)

If you want to write a program to read a test's output and presents it in color, that seems easy to do with the current output, without any additional help from the go command or the testing package.

I will write a tool to consume the go test output instead, thanks for the input.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelsafyan picture michaelsafyan  路  3Comments

gopherbot picture gopherbot  路  3Comments

ianlancetaylor picture ianlancetaylor  路  3Comments

jayhuang75 picture jayhuang75  路  3Comments

ashb picture ashb  路  3Comments