17.33. go

Important:

Ports should not be created for Go libs, see Section 6.29, “Go Libraries” for more information.

Possible arguments: (none), modules

Sets default values and targets used to build Go software. A build-time dependency on lang/go is added. By default the build is performed in GOPATH mode. If Go software uses modules, the modules-aware mode can be switched on with modules.

The build process is controlled by several variables:

GO_PKGNAME

The name of the Go package. When building in GOPATH mode, this is the directory that will be created in ${GOPATH}/src and seen by the go. When building in modules-aware mode, no GOPATH directories will be created and GO_PKGNAME value will be only used as a default for GO_TARGET. If not set explicitly and GH_SUBDIR is present, GO_PKGNAME value will be inferred from ${GH_SUBDIR}, otherwise it will be set to ${PORTNAME}.

GO_TARGET

The name of the packages to build. The default value is ${GO_PKGNAME}.

CGO_CFLAGS

Additional CFLAGS values to be passed to the C compiler by go.

CGO_LDFLAGS

Additional LDFLAGS values to be passed to the C compiler by go.

GO_BUILDFLAGS

Additional build arguments to be passed to go install.

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.