GO-ENV.ECLASS
Section: eclass-manpages (5)Updated: Mar 2026
Index Return to Main Contents
NAME
go-env.eclass - Helper eclass for setting up the Go build environment.DESCRIPTION
This eclass includes helper functions for setting up the build environment for Go ebuilds. Intended to be called by other Go eclasses in an early build stage, e.g. src_unpack.SUPPORTED EAPIS
7 8FUNCTIONS
- go-env_set_compile_environment
- Sets up the environment to build Go code for CHOST. This includes variables required for cross-compiling, cgo-related variables, and architecture-specific variables. GO386, GOARM, GOMIPS, and GOMIPS64 are set based on the tuple. Variables for other architectures need to be set manually by users. This function must be called (implicitly or otherwise) before building any Go code whether cross-compiling or not. Make any build flag changes (e.g. CFLAGS) before calling this function.
- go-env_run
- Runs the given command under a localised environment configured by go-env_set_compile_environment. It is not usually necessary to call this, but it is useful when combined with tc-env_build.
- go-env_goos [toolchain prefix]
- Returns the appropriate GOOS setting for the target operating system.
- go-env_goarch [toolchain prefix]
- Returns the appropriate GOARCH setting for the target architecture.
- go-env_go386
- Returns the appropriate GO386 setting for the CFLAGS in use.
- go-env_goarm [tuple]
- Returns the appropriate GOARM setting for given target or CHOST.
- go-env_gomips [tuple]
- Returns the appropriate GOMIPS or GOMIPS64 setting for given target or CHOST.
ECLASS VARIABLES
- GOMAXPROCS (USER VARIABLE)
- The maximum number of processes for the Go runtime to run in parallel. See https://pkg.go.dev/runtime#GOMAXPROCS. If unset, this defaults to the configured number of Make jobs. Unfortunately, Go does not currently support the GNU Make jobserver, so this may not play nicely alongside other build processes. However, Go code is often built without a supporting build system or without other non-Go code, so this should be sufficient in most cases.
- GOAMD64 (USER VARIABLE)
- Optimisation setting for amd64 when building for CHOST. See https://golang.org/wiki/MinimumRequirements#amd64.
- GOARM64 (USER VARIABLE)
- Optimisation setting for arm64 when building for CHOST. See https://pkg.go.dev/cmd/go/internal/help#pkg-variables.
- GOPPC64 (USER VARIABLE)
- Optimisation setting for ppc64 when building for CHOST. See https://pkg.go.dev/cmd/go/internal/help#pkg-variables.
- GORISCV64 (USER VARIABLE)
- Optimisation setting for riscv when building for CHOST. See https://pkg.go.dev/cmd/go/internal/help#pkg-variables.
- BUILD_GOAMD64 (USER VARIABLE)
- Optimisation setting for amd64 when building for CBUILD.
- BUILD_GOARM64 (USER VARIABLE)
- Optimisation setting for arm64 when building for CBUILD.
- BUILD_GOPPC64 (USER VARIABLE)
- Optimisation setting for ppc64 when building for CBUILD.
- BUILD_GORISCV64 (USER VARIABLE)
- Optimisation setting for riscv when building for CBUILD.
AUTHORS
Flatcar Linux Maintainers <infra@flatcar-linux.org>MAINTAINERS
Flatcar Linux Maintainers <infra@flatcar-linux.org>REPORTING BUGS
Please report bugs via https://bugs.gentoo.org/FILES
go-env.eclassSEE ALSO
ebuild(5)https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/go-env.eclass
Index
- NAME
- DESCRIPTION
- SUPPORTED EAPIS
- FUNCTIONS
- ECLASS VARIABLES
- AUTHORS
- MAINTAINERS
- REPORTING BUGS
- FILES
- SEE ALSO
This document was created by man2html, using the manual pages.
Time: 03:27:02 GMT, March 22, 2026