Skip to content

Go - Customizing Go Binaries with Build Tags#

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#

[!WARNING]
New versions of go have native support for this!

[!NOTE]
The experiments are available via build tags, so you can build with:

as of Go 1.22 the rangefunc experiment is available

Sources#