]> Cypherpunks repositories - gostls13.git/commit
cmd/go: print build errors during go test -json in JSON
authorAustin Clements <austin@google.com>
Tue, 17 Oct 2023 21:27:00 +0000 (17:27 -0400)
committerAustin Clements <austin@google.com>
Sun, 17 Nov 2024 14:32:05 +0000 (14:32 +0000)
commitf9a95b1bdcff42730c836a792b27740b9c0df645
treed37d7c9d345363861518e7e2935ddaca85839bf2
parent9060fa5afd52fcdb60c09e26c73f5980520ca9f9
cmd/go: print build errors during go test -json in JSON

Currently, if a test or imported package fails to build during "go
test -json", the build error text will be interleaved with the JSON
output of tests. Furthermore, there’s currently no way to reliably
associate a build error with the test package or packages it affected.
This creates unnecessary friction and complexity in tools that consume
the "go test -json" output.

This CL makes "go test -json" enable JSON reporting of build errors.
It also adds a "FailedBuild" field to the "fail" TestEvent, which
gives the package ID of the package that failed to build and caused
the test to fail.

Using this, CI systems should be able to consume the entire output
stream from "go test -json" in a structured way and easily associate
build failures with test failures during reporting.

Fixes #62067.
Updates #35169.
Updates #37486.

Change-Id: I49091dcc7aa52db01fc9fa6042771633e97b8407
Reviewed-on: https://go-review.googlesource.com/c/go/+/536399
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
doc/next/3-tools.md
src/cmd/go/alldocs.go
src/cmd/go/internal/help/helpdoc.go
src/cmd/go/internal/list/list.go
src/cmd/go/internal/load/test.go
src/cmd/go/internal/test/test.go
src/cmd/go/internal/test/testflag.go
src/cmd/go/internal/vet/vet.go
src/cmd/go/testdata/script/test_json_build.txt [new file with mode: 0644]
src/cmd/internal/test2json/test2json.go
src/cmd/test2json/main.go