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

Closed
gopherbot opened this issue Sep 18, 2014 · 8 comments
Closed

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

gopherbot opened this issue Sep 18, 2014 · 8 comments

Comments

@gopherbot
Copy link

by kyle.erf@10gen.com:

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
(http://golang.org/pkg/go/build/#hdr-Build_Constraints)  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.
@ianlancetaylor
Copy link
Contributor

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
@yonderblue
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.

@derekperkins
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.

@ryancouto
Copy link

@derekperkins find anything? also looking.

@davecheney
Copy link
Contributor

-tag a,b,c

On Fri, 7 Oct 2016, 08:35 Ryan Couto notifications@github.com wrote:

@derekperkins https://github.com/derekperkins find anything? also
looking.


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
https://github.com/notifications/unsubscribe-auth/AAAcA-MO8B6N8f6vy4hqhe7lKhBooy8Wks5qxWmIgaJpZM4Ej5ol
.

@akaspin
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
@bradfitz
Copy link
Contributor

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

@quentinmit
Copy link
Contributor

Dupe of #17148

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

No branches or pull requests

10 participants