GO-JUNIT-REPORT(1)

πŸ“¦
version 2.1.0 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

✨ 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 πŸ’œ

  • -in file β€” read the log from file. if you don't specify it, stdin is used. πŸ’–
  • -out file β€” write the XML report to file. if you don't specify it, stdout is used. ✨
  • -iocopy β€” copy input to stdout. can only be used in conjunction with -out. this is useful if you want to see what was sent to go-junit-report. πŸ‘€
  • -no-xml-header β€” do not print the XML header. that's it, that's the whole vibe. πŸ™ˆ
  • -p key=value β€” add a key=value property to the generated report. repeat this flag to add multiple properties. stack 'em up, queen πŸŽ€
  • -package-name name β€” 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 πŸ’…
  • -parser string β€” set the input parser type: gotest or gojson (default: gotest).
  • -set-exit-code β€” set exit code to 1 if tests failed. that's the dramatic exit, and honestly? valid. πŸ’€
  • -subtest-mode mode β€” 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 the go-junit-report version. humble brag, as she should 🌈
  • -debug.print-events β€” print events generated by the go test parser. nyoom, look at the little events go πŸ¦‹
  • -go-version string β€” (deprecated, use -prop) the value to use for the go.version property in the generated XML. ⚠️ bestie it is literally deprecated, go use -prop instead, i'm begging

🌟 EXIT STATUS 🌟

  • If go-junit-report encounters an error during its operation, or doesn't understand its command-line options, 2 is returned. 😭
  • If the input logs indicate the tests failed, and -set-exit-code is specified, 1 is returned. πŸ’€
  • Otherwise, 0 is returned. slay, no notes ✨

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