Customizing Go Binaries with Build Tags
Source:
In your source code put this as the first line:
// +build tag_name
or (to include):
//go:build tag_name
alternatively (to exclude):
// +build !tag_name
Then build with:
go build -tags tag_name
Go experiments
NOTE The experiments are available via build tags, so you can build with:
as of Go 1.22 the rangefunc
experiment is available
//go:build goexperiment.rangefunc
package example
GOEXPERIMENT=rangefunc go build
Tags
Backlinks