Radar · Go · Archive · Week 11 · Mar 9 – 15, 2026
Annotate test output JSON with an “Error” flag
Worth knowingtooling
- What changed
- The proposal adds a boolean field “Error” to “output” actions in the JSON produced by
cmd/test2json. This field is true for output produced via(*testing.T).Error{,f}and(*testing.T).Fatal{,f}, and for the first few lines of a crash (but not the stack trace). - Production impact
- The source does not say.
- Try it
- Run
go test -jsonon a package that usest.Errorand inspect the resulting JSON for the new “Error” field. - Source
- github.com/golang/go/issues/62728
Understand it, then run it
The go test -json command turns test output into a stream of JSON objects. Until now, every line of output—whether it came from t.Log, t.Error, or a panic—looked the same. The change adds a new boolean field called Error to each JSON object that represents a line of output. If the line was produced by t.Error, t.Fatal, or the first few lines of a crash, Error is true; otherwise it is false. This lets tools know which lines are part of a test failure rather than just noise.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed