Options for Go tests.

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

Basic options

args

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

PANTS_GO_TEST_ARGS

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.


cover_mode

--go-test-cover-mode=<GoCoverMode>

PANTS_GO_TEST_COVER_MODE

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

coverage_output_dir

--go-test-coverage-output-dir=<str>

PANTS_GO_TEST_COVERAGE_OUTPUT_DIR

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

None