Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/build: explain -tags better in the go/build documentation #8772

gopherbot opened this issue Sep 18, 2014 · 8 comments

go/build: explain -tags better in the go/build documentation #8772

gopherbot opened this issue Sep 18, 2014 · 8 comments


Copy link


The help text for the "go build" command says:

    -tags 'tag list'
        a list of build tags to consider satisfied during the build.
        For more information about build tags, see the description of
        build constraints in the documentation for the go/build package.

however, nothing in the go/build documentation page
(  says anything about the
"-tags" option. There is one reference to "ctxt.BuildTags," but no
examples of actually calling "go build" with -tags set.

It would be great if the documentation included an example of using -tags to pass in
custom build constraints. As it is, there are no examples of this powerful feature,
aside from a test shell script that ships with the go source.
Copy link

Comment 1:

Labels changed: added repo-main, release-none, documentation.

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
Copy link

Are custom build tags intended to be used? I just tried to set up a build program using them but ran into the fact that vet doesn't have a -tags option.

Copy link

I've been looking for about 20 minutes to find out how to use multiple build tags and still haven't found the answer.

Copy link

@derekperkins find anything? also looking.

Copy link

-tag a,b,c

On Fri, 7 Oct 2016, 08:35 Ryan Couto wrote:

@derekperkins find anything? also

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#8772 (comment), or mute
the thread

Copy link

akaspin commented Oct 14, 2016

@davecheney No luck. A have two different files: first with "debug" (in lib) tag and second with "lowlevel" (in test).

$ go test -tags debug ./...    # OK
$ go test -tags lowlevel ./...    # OK
$ go test -tags lowlevel,debug ./...
... [no test files]

If I remove // +build lowlevel from test file - tests runs. But with "-tags lowlevel,debug" "debug" tag has no effect.

UPD: This works

$ go test -tags="lowlevel debug" ./...

@bradfitz bradfitz modified the milestones: Go1.8, Unplanned Oct 15, 2016
Copy link

This bit me too recently. IIRC, one tool wanted commas and another wanted spaces.

Copy link

Dupe of #17148

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

10 participants