Skip to main content
Version: 2.10 (deprecated)

golang


Options for Golang support.

Backend: pants.backend.experimental.go

Config section: [golang]

Basic options

expected_version

--golang-expected-version=<str>
PANTS_GOLANG_EXPECTED_VERSION
pants.toml
[golang]
expected_version = <str>
default: 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.

go_search_paths

--golang-go-search-paths="['<str>', '<str>', ...]"
PANTS_GOLANG_GO_SEARCH_PATHS
pants.toml
[golang]
go_search_paths = [
'<str>',
'<str>',
...,
]
default:
[
  "<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.

Advanced options

subprocess_env_vars

--golang-subprocess-env-vars="['<str>', '<str>', ...]"
PANTS_GOLANG_SUBPROCESS_ENV_VARS
pants.toml
[golang]
subprocess_env_vars = [
'<str>',
'<str>',
...,
]
default:
[
  "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.

Deprecated options

None

None