Skip to main content
Version: 2.15 (deprecated)

go-test


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
pants.toml
[go-test]
args = [
<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.

cover_mode

--go-test-cover-mode=<GoCoverMode>
PANTS_GO_TEST_COVER_MODE
pants.toml
[go-test]
cover_mode = <GoCoverMode>
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.

coverage_html

--[no-]go-test-coverage-html
PANTS_GO_TEST_COVERAGE_HTML
pants.toml
[go-test]
coverage_html = <bool>
default: True

If true, then convert coverage reports to HTML format and write a coverage.html file next to the raw coverage data.

skip

--[no-]go-test-skip
PANTS_GO_TEST_SKIP
pants.toml
[go-test]
skip = <bool>
default: False

If true, don't use Go test binary when running /home/josh/work/scie-pants/dist/pants test.

Advanced options

coverage_output_dir

--go-test-coverage-output-dir=<str>
PANTS_GO_TEST_COVERAGE_OUTPUT_DIR
pants.toml
[go-test]
coverage_output_dir = <str>
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

None