HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies
Hey! These docs are for version 2.14, which is no longer officially supported. Click here for the latest version, 2.17!


Options for Go tests.

Backend: <span style="color: purple"><code>pants.backend.experimental.go</code></span> Config section: <span style="color: purple"><code>[go-test]</code></span>

## Basic options

<div style="color: purple">

### `args`

<code>--go-test-args="[&lt;shell_str&gt;, &lt;shell_str&gt;, ...]", ... -- [<shell_str> [<shell_str> [...]]]</code><br> <code>PANTS_GO_TEST_ARGS</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>[]</code></span>

<br>

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.

</div> <br>

<div style="color: purple">

### `cover_mode`

<code>--go-test-cover-mode=<GoCoverMode></code><br> <code>PANTS_GO_TEST_COVER_MODE</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">one of: <code>set, count, atomic</code></span><br> <span style="color: green">default: <code>set</code></span>

<br>

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.

    </div> <br>

## Advanced options

<div style="color: purple">

### `coverage_output_dir`

<code>--go-test-coverage-output-dir=<str></code><br> <code>PANTS_GO_TEST_COVERAGE_OUTPUT_DIR</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>{distdir}/coverage/go/{import&lowbar;path&lowbar;escaped}</code></span>

<br>

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.

</div> <br>

## Deprecated options

None