//+build build_on_this_tag !not_on_this package somePackage // ...code... // Use: // go build -tags build_on_this_tag // more info https://golang.org/pkg/go/build/