Skip to content

go-test: a failing benchmark in -v=false JSON shows Go's benchmark header as failure context #5215

Description

@KuSh

go test -json -v=false -bench . -benchtime 10x -run '^$' ./failb (Go 1.26.1; BenchmarkFail calls b.Fatal, BenchmarkGood passes), piped to rtk pipe -f go-test:

Go test: 0 passed, 1 failed in 1 packages

failb (0 passed, 1 failed)
  [FAIL] BenchmarkFail
     f_test.go:7: benchmark intentionally failed
     goos: linux

In quiet mode test2json tags the lines that follow the failing benchmark with its Test field (goos:, goarch:, pkg:, cpu:, the next benchmark's name and result), so the failure-line selection picks goos: linux as context. Same output on v1.2.1 and develop ef0b734.

Activity

  1. KuSh commented on Nov 28, 2026

    @KuSh
    CollaboratorAuthor

    There are 2 open pull requests for this issue: #5216, #5220 (oldest first).

    If you were about to start on it, reviewing or testing one of these helps more than another pull request: a note on which approach fits, or a test result on your setup, is welcome on the pull request itself.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions