Options for Golang support.
Backend: <span style="color: purple"><code>pants.backend.experimental.go</code></span> Config section: <span style="color: purple"><code>[golang]</code></span>
## Basic options
<div style="color: purple">
### `go_search_paths
`
<code>--golang-go-search-paths="['<str>', '<str>', ...]"</code><br> <code>PANTS_GOLANG_GO_SEARCH_PATHS</code><br>
</div> <div style="padding-left: 2em;"> <span style="color: green">default: <pre>[ "<PATH>" ]</pre></span>
<br>
A list of paths to search for Go.
Specify absolute paths to directories with the `go
` binary, e.g. `/usr/bin
`. Earlier entries will be searched first.
The special string `"<PATH>"
` will expand to the contents of the PATH env var.
</div> <br>
<div style="color: purple">
### `minimum_expected_version
`
<code>--golang-minimum-expected-version=<str></code><br> <code>PANTS_GOLANG_MINIMUM_EXPECTED_VERSION</code><br>
</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>1.17</code></span>
<br>
The minimum Go version the distribution discovered by Pants must support.
For example, if you set `'1.17'
`, then Pants will look for a Go binary that is 1.17+, e.g. 1.17 or 1.18.
You should still set the Go version for each module in your `go.mod
` with the `go
` directive.
Do not include the patch version.
</div> <br>
## Advanced options
<div style="color: purple">
### `subprocess_env_vars
`
<code>--golang-subprocess-env-vars="['<str>', '<str>', ...]"</code><br> <code>PANTS_GOLANG_SUBPROCESS_ENV_VARS</code><br>
</div> <div style="padding-left: 2em;"> <span style="color: green">default: <pre>[ "LANG", "LC_CTYPE", "LC_ALL", "PATH" ]</pre></span>
<br>
Environment variables to set when invoking the `go
` tool. Entries are either strings in the form `ENV_VAR=value
` to set an explicit value; or just `ENV_VAR
` to copy the value from Pants's own environment.
</div> <br>
<div style="color: purple">
### `tailor_go_mod_targets
`
<code>--[no-]golang-tailor-go-mod-targets</code><br> <code>PANTS_GOLANG_TAILOR_GO_MOD_TARGETS</code><br>
</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>True</code></span>
<br>
If true, add a `go_mod
` target with the `tailor
` goal wherever there is a `go.mod
` file.
</div> <br>
<div style="color: purple">
### `tailor_package_targets
`
<code>--[no-]golang-tailor-package-targets</code><br> <code>PANTS_GOLANG_TAILOR_PACKAGE_TARGETS</code><br>
</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>True</code></span>
<br>
If true, add a `go_package
` target with the `tailor
` goal in every directory with a `.go
` file.
</div> <br>
<div style="color: purple">
### `tailor_binary_targets
`
<code>--[no-]golang-tailor-binary-targets</code><br> <code>PANTS_GOLANG_TAILOR_BINARY_TARGETS</code><br>
</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>True</code></span>
<br>
If true, add a `go_binary
` target with the `tailor
` goal in every directory with a `.go
` file with `package main
`.
</div> <br>
## Deprecated options
<div style="color: purple">
### `expected_version
`
<code>--golang-expected-version=<str></code><br> <code>PANTS_GOLANG_EXPECTED_VERSION</code><br>
</div>
<div style="padding-left: 2em;">
<span style="color: green">default: <code>1.17</code></span>
<p style="color: darkred">Deprecated, is scheduled to be removed in version: 2.14.0.dev0.<br>Use `[golang].minimum_expected_version
` instead, which is more flexible. Pants will now work if your local Go binary is newer than the expected minimum version; e.g. Go 1.18 works with the version set to `1.17
`.</p>
<br>
The Go version you are using, such as `1.17
`.
Pants will only use Go distributions from `--go-search-paths
` that have the expected version, and it will error if none are found.
Do not include the patch version.
</div> <br>