Open grasparv opened 4 years ago
/cc @matloob @bcmills @jayconrod
This is a consequence of the way go test
collects output from test binaries. Test binaries print output and events on stdout in a line-based text format. Tests can write directly to stdout, and there's no escaping for significant whitespace, even with t.Log
, so there's no way for go test
to tell whether output containing newlines came from separate writes.
There are a number of issues related to go test -v
and go test -json
like this. To fix them, I think we should consider sending more structured output over some other channel, like a socket or pipe passed to the test process. Or maybe tests should write logs to a file, and go test
should parse that. It will be tricky finding something portable to all platforms that doesn't interfere with existing tests though.
I maintain a test runner tool (https://github.com/grasparv/testie).
Here is my problem:
I expected seeing first and second item reported as a single entry (instead second entry gets its own log event). The above is an issue since it destroys information by breaking lines. For instance, my test runner tool might want to change indentation on some messages, but here it is impossible to see which log lines that actually belong together.