-
Notifications
You must be signed in to change notification settings - Fork 18k
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
proposal: cmd/test2json: provide stderr flag for output #61856
Comments
This is not feasible in general. The problem is that you can have either (A) stdout and stderr merged into one, preserving the relative ordering of writes to stdout and writes to stderr, or (B) separate stdout and stderr, losing information about the relative ordering of individual messages. Go has chosen (A), because often programs are not terribly consistent about stdout vs stderr and often you care a lot about not reordering the relative outputs. There is not stdout and stderr; there is just "Output". |
Makes sense, thank you. At first I was confused with the current behaviour, since despite having a single output channel, the channel is different for different tools. For example, running a go program or a compiled test, everything printed with What is the reason for having stderr by default and stdout for test2json? |
This proposal has been added to the active column of the proposals project |
Mostly to separate the other non-JSON error output that the go command can print. |
This proposal has been declined as infeasible. |
Running the following test
either with
go test -json
or withgo test -c && go tool test2json pkg.test -test.v
produces json lines with the panic stacktrace. It is unclear thought whether the output is stdout or stderr from the json:Writing tools to present the output, I would like to distinguish stderr to paint it in a different color in the user console. Please consider adding a flag to the
output
json event.The text was updated successfully, but these errors were encountered: