← All install guides

Agent-friendly version of this page: /install/go.md

Installing TestGlance for Go

1. Make tests emit JUnit XML

go test does not emit JUnit XML on its own. Use either go-junit-report (pipes go test -v output into JUnit XML) or gotestsum (a wrapper that produces JUnit XML directly).

Option A: go-junit-report

Install it once on the runner:

go install github.com/jstemmer/go-junit-report/v2@latest

Run tests like this in CI:

mkdir -p test-results
go test -v ./... 2>&1 | go-junit-report > test-results/go.xml

Option B: gotestsum

go install gotest.tools/gotestsum@latest
mkdir -p test-results
gotestsum --junitfile test-results/go.xml ./...

Pick whichever fits the project. gotestsum is friendlier for local runs; go-junit-report is the simpler dependency.

2. Add the TestGlance step to CI

If the project already has a CI workflow that runs the tests, add this step to the test job (after the test step), and merge the permissions: block at the workflow's top level:

permissions:
  contents: read
  pull-requests: write
 
# ...inside the test job, after the test step:
- uses: testglance/action@v1
  if: always()
  with:
    github-token: ${{ github.token }}

If no CI workflow runs the tests yet, create .github/workflows/testglance.yml that runs the project's tests and then runs the TestGlance step.

if: always() matters — TestGlance should still run when tests fail. TestGlance auto-discovers anything matching **/test-results/*.xml, so no report-path is needed when reports land under test-results/.

3. Confirm with the user before committing

Summarize the diff and ask the user to confirm before staging or committing. Do not push.