reporter

Structured Go test failure reports

Go DevOps GitHub

Parse go test output into structured failure reports. Auto-detects JSON or verbose format. Extracts test name, package, source location, and diagnostic output. Filters parent test noise.

Features

  • Parses go test -json and go test -v output
  • Extracts test name, package, source location
  • Filters parent test noise - reports only leaf failures
  • Structured JSON output

Install

go install github.com/hegner123/reporter@latest

The Problem: go test output is verbose and hard to parse

$ go test -v ./...
--- FAIL: TestUserCreate (0.02s)
    --- FAIL: TestUserCreate/invalid_email (0.01s)
        user_test.go:45: expected error for invalid email
            got: nil
            want: ErrInvalidEmail
--- FAIL: TestUserCreate/duplicate (0.01s)
    user_test.go:67: unexpected error
        got: context deadline exceeded
        want: ErrDuplicate
FAIL

# Parent test (TestUserCreate) clutters the output.
# Source locations mixed with diagnostic text.
# AI agents waste tokens parsing this manually.

Solution

$ go test -v ./... | reporter --cli

Output

{"failures":[{"test":"TestUserCreate/invalid_email","package":"myapp/pkg/users","file":"user_test.go","line":45,"message":"expected error for invalid email\ngot: nil\nwant: ErrInvalidEmail"},{"test":"TestUserCreate/duplicate","package":"myapp/pkg/users","file":"user_test.go","line":67,"message":"unexpected error\ngot: context deadline exceeded\nwant: ErrDuplicate"}],"total_tests":12,"passed":10,"failed":2}

Comparison

MetricValue
Noise reductionFilters parent tests, keeps only leaf failures
Formatsgo test -json and go test -v
OutputStructured JSON with file + line numbers