golang
Options for Golang support.
Backend: pants.backend.experimental.go.lint.golangci_lint
Config section: [golang]
Basic options
cgo_enabled
--[no-]golang-cgo-enabled
PANTS_GOLANG_CGO_ENABLED
[golang]
cgo_enabled = <bool>
True
Enable Cgo support, which allows Go and C code to interact. This option must be enabled for any packages making use of Cgo to actually be compiled with Cgo support.
See https://go.dev/blog/cgo and https://pkg.go.dev/cmd/cgo for additional information about Cgo.
cgo_tool_search_paths
--golang-cgo-tool-search-paths="['<str>', '<str>', ...]"
PANTS_GOLANG_CGO_TOOL_SEARCH_PATHS
[golang]
cgo_tool_search_paths = [
'<str>',
'<str>',
...,
]
[ "<PATH>" ]
A list of paths to search for tools needed by CGo (e.g., gcc, g++).
Specify absolute paths to directories with tools needed by CGo , e.g. /usr/bin
. Earlier entries will be searched first.
The following special strings are supported:
<PATH>
, the contents of the PATH environment variable
golang_cgo_tool_search_paths
on local_environment
, docker_environment
, or remote_environment
targets.go_search_paths
--golang-go-search-paths="['<str>', '<str>', ...]"
PANTS_GOLANG_GO_SEARCH_PATHS
[golang]
go_search_paths = [
'<str>',
'<str>',
...,
]
[ "<PATH>" ]
A list of paths to search for Go and extra tools needed by go.
Specify absolute paths to directories with the go
binary, e.g. /usr/bin
. Earlier entries will be searched first.
The following special strings are supported:
<PATH>
, the contents of the PATH environment variableAsdfPathString.STANDARD
, all Go versions currently configured by ASDF(asdf shell, ${HOME}/.tool-versions)
, with a fallback to all installed versionsAsdfPathString.LOCAL
, the ASDF binary with the version inBUILD_ROOT/.tool-versions
golang_go_search_paths
on local_environment
, docker_environment
, or remote_environment
targets.minimum_expected_version
--golang-minimum-expected-version=<str>
PANTS_GOLANG_MINIMUM_EXPECTED_VERSION
[golang]
minimum_expected_version = <str>
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.