Ports should not be created for Go libs, see Section 6.29, “Go Libraries” for more information.
Possible arguments: (none), modules
,
no_targets
, run
Sets default values and targets used to build
Go software. A build dependency
on the Go compiler port selected via GO_PORT
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
argument.
no_targets
will setup build environment like
GO_ENV
, GO_BUILDFLAGS
but
skip creating post-extract
and
do-{build,install,test}
targets.
run
will also add a run dependency on
what is in GO_PORT
.
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
. If
not set explicitly and GH_SUBDIR
or
GL_SUBDIR
is present,
GO_PKGNAME
will be inferred from it.
It is not needed when building in modules-aware
mode.
GO_TARGET
The packages to build. The default
value is ${GO_PKGNAME}
.
GO_TARGET
can also be a tuple in the
form package:path
where path can be
either a simple filename or a full path starting with
${PREFIX}
.
GO_TESTTARGET
The packages to test. The default
value is ./...
(the current package
and all subpackages).
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 build
.
GO_TESTFLAGS
Additional build arguments to be passed to
go test
.
GO_PORT
The Go compiler port to use. By default this is
lang/go but can be set
to lang/go-devel in
make.conf
for testing with future Go
versions.
This variable must not be set by individual ports!
See Section 6.5.8, “Building Go Applications” for usage examples.
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>.