Options for Go tests.

Backend: pants.backend.experimental.go
Config section: [go-test]

Basic options


--go-test-args="[<shell_str>, <shell_str>, ...]", ... -- [<shell_str> [<shell_str> [...]]]


default: []

Arguments to pass directly to Go test binary, e.g. --go-test-args='-run TestFoo -v'.

Known Go test options will be transformed into the form expected by the test binary, e.g. -v becomes -test.v. Run go help testflag from the Go SDK to learn more about the options supported by Go test binaries.




one of: set, count, atomic
default: set

Coverage mode to use when running Go tests with coverage analysis enabled via --test-use-coverage. Valid values are set, count, and atomic:

  • set: bool: does this statement run?

  • count: int: how many times does this statement run?

  • atomic: int: count, but correct in multithreaded tests; significantly more expensive.

Advanced options




default: {distdir}/coverage/go/{import_path_escaped}

Path to write the Go coverage reports to. Must be relative to the build root. {distdir} is replaced with the Pants distdir, and {import_path_escaped} is replaced with the applicable package's import path but with slashes converted to underscores.

Deprecated options