golang
Options for Golang support.
Backend: pants.backend.experimental.go
Config section: [golang]
Basic options
[ "<PATH>" ]
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.
minimum_expected_version
minimum_expected_version
--golang-minimum-expected-version=<str>
PANTS_GOLANG_MINIMUM_EXPECTED_VERSION
1.17
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.
Advanced options
subprocess_env_vars
subprocess_env_vars
--golang-subprocess-env-vars="['<str>', '<str>', ...]"
PANTS_GOLANG_SUBPROCESS_ENV_VARS
[ "LANG", "LC_CTYPE", "LC_ALL", "PATH" ]
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.
True
If true, add a go_mod
target with the tailor
goal wherever there is a go.mod
file.
True
If true, add a go_package
target with the tailor
goal in every directory with a .go
file.
True
If true, add a go_binary
target with the tailor
goal in every directory with a .go
file with package main
.
Deprecated options
1.17
Deprecated, is scheduled to be removed in version: 2.14.0.dev0.
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`.
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.
Updated about 1 year ago