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

proposal: cmd/go: go test -json to write to a file instead of stdout #66271

IvanRibakov opened this issue Mar 12, 2024 · 2 comments


Copy link

Proposal Details

It is a common usage pattern to run test command and to feed test report and coverage data to an external platform (for example a code quality or code coverage tools). As such, there is value in having both plain text user-friendly output in stdout and a machine-readable JSON output in a separate file. Unfortunately, both outputs can not be obtained at the moment and developers must choose between having easy-to-navigate local test reports or satisfying the external integrations and wait for them to sync and process the report data.

@gopherbot gopherbot added this to the Proposal milestone Mar 12, 2024
Copy link

-json just runs test2json on the normal output. So you can do go test . | tee out.log
and later run go tool test2json < out.log to convert it to json for your other tooling.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
Copy link

What about this caveat?

Note also that test2json is only intended for converting a single test binary's output. To convert the output of a "go test" command that runs multiple packages, again use "go test -json".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants