GO-JUNIT-REPORT(1)
β¨ NAME β¨
go-junit-report β the little icon that turns your Go test output into JUnit XML π
π¦ SYNOPSIS π¦
go-junit-report [-in file] [-out file] [options...]
go-junit-report -version
go-junit-report -help
πΈ DESCRIPTION πΈ
okay so bestie, listen. go-junit-report is the tool that converts go test output into a JUnit-compatible XML report, which is perfect for feeding into stuff like Jenkins or GitLab CI. it's giving pipeline-ready. it's giving CI royalty. π
By default, go-junit-report reads go test -v output β the kind generated by the standard library testing package β from stdin, and writes a JUnit XML report to stdout. that's the no-cap default behavior, periodt.
Go build and runtime errors are also supported, but heads up: for that you need stderr redirected into go-junit-report too. can't skip that step, she needs both streams.
Typical use looks like this:
go test -v 2>&1 ./... | go-junit-report -set-exit-code > report.xml
Alternatively, go-junit-report can consume JSON output of go test. in this case, stderr still needs to be redirected for build errors to be detected β yes, same rule, no exceptions:
go test -json 2>&1 | go-junit-report -parser gojson > report.xml
The -iocopy flag copies stdin directly to stdout, which is useful if you still want to actually see the go test output. like, bestie, you don't have to give it up entirely:
go test -v 2>&1 ./... | go-junit-report -set-exit-code -iocopy -out report.xml
π OPTIONS π
-infile β read the log from file. if you don't specify it,stdinis used. π-outfile β write the XML report to file. if you don't specify it,stdoutis used. β¨-iocopyβ copy input tostdout. can only be used in conjunction with-out. this is useful if you want to see what was sent togo-junit-report. π-no-xml-headerβ do not print the XML header. that's it, that's the whole vibe. π-pkey=value β add a key=value property to the generated report. repeat this flag to add multiple properties. stack 'em up, queen π-package-namename β specify a default package name to use if the test log doesn't contain a package name. a lil fallback for when the log is being mysterious π-parserstring β set the input parser type:gotestorgojson(default:gotest).-set-exit-codeβ set exit code to1if tests failed. that's the dramatic exit, and honestly? valid. π-subtest-modemode β set subtest mode:ignore-parent-results(subtest parents always pass),exclude-parents(subtest parents are excluded from the report).-helpβ print a summary of command-line options. help a girl out π«Ά-versionβ print thego-junit-reportversion. humble brag, as she should π-debug.print-eventsβ print events generated by thego testparser. nyoom, look at the little events go π¦-go-versionstring β (deprecated, use-prop) the value to use for thego.versionproperty in the generated XML. β οΈ bestie it is literally deprecated, go use-propinstead, i'm begging
π EXIT STATUS π
- If
go-junit-reportencounters an error during its operation, or doesn't understand its command-line options,2is returned. π - If the input logs indicate the tests failed, and
-set-exit-codeis specified,1is returned. π - Otherwise,
0is returned. slay, no notes β¨
π COPYRIGHT π
Copyright (C) 2025 Andrej Shadura.
and that's the whole page, bestie π«Ά this one's from the GO-JUNIT-REPORT(1) manual, dated 2026-02-03. go forth and make your CI pretty ππβ¨
π¦ where this page comes from
- ubuntu resolute: go-junit-report 2.1.0-1.1build1 Β· MIT
- ubuntu stonking: go-junit-report 2.1.0-1.1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms