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

cmd/go: install -tags option behaves differently if you pass pkg/a pkg/b vs pkg/... #4515

Closed
slimsag opened this issue Dec 10, 2012 · 7 comments
Milestone

Comments

@slimsag
Copy link

slimsag commented Dec 10, 2012

What steps will reproduce the problem?

1. Create go source file example/a/a.go with the contents:
  package main

  func main() {}

2. Create go source file example/b/b.go with the contents:
  // +build bug

  package main

  func main() {}


1. go install -tags 'bug' example/a example/b
2. ls $GOPATH/bin/ reports that binaries "a" and "b" exist.

3. Delete both "a" and "b" binaries from bin/ directory; now run:
4. go install -tags 'bug' example/...
5. ls $GOPATH/bin/ reports that only binary "a" exists.

6. Recognize that binary "b" is only generated if specified with an import
path of pkg/b instead of pkg/...


What is the expected output?
The -flags option should handle import paths such as pkg/a pkg/b and pkg/... the same
way (producing two executable's, both "a" and "b", inside bin/
directory)

What do you see instead?
A single executable file, "a", specifically the executable without build tags
is compiled.
The -flags option compiles only the binary "b" if you specify it manually
pkg/b (versus pkg/...)

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g (I think? Ubuntu 12.10, x86, 64 bit, using standard 'go install')

Which operating system are you using?
Ubuntu 12.10 64 bit

Which version are you using?  (run 'go version')
go version devel +21d62bd46e78 Mon Dec 10 01:42:53 2012 -0500 linux/amd64

Please provide any additional information below.

I'm glad to test anything else I can or provide more information if possible / clarify
anything hard to understand, please let me know if there is anything like that.

- Stephen
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added priority-later, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Jan 31, 2013

Comment 2:

I'm sorry but I can't reproduce this. The ... wildcard seems to work just fine. I will
add a -tags flag to the 'go list' command so that we can debug further.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jan 31, 2013

Comment 3:

Please update to tip and try
go list example/...
go list -tags bug example/...
and see if they differ. If so that would explain go install differing, although I am
still at a loss to understand how that happens.

@slimsag
Copy link
Author

slimsag commented Jan 31, 2013

Comment 4:

Hi,
I can no longer reproduce my original results either, I'm sure at the time of submitting
this they where accurate, however, it seems this has been fixed at tip.
both 'go list' and 'go install' work fine now.
Thank you,
- Stephen

@rsc
Copy link
Contributor

rsc commented Feb 1, 2013

Comment 5:

Status changed to Retracted.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@stevvooe
Copy link

@rsc I ran into a similar problem with go list and go test skipping over a package that should be enabled by the provided tags. The tags seem to apply correctly during the build but the package gets skipped if no files are left before "applying" tags.

As a workaround, for any package that may be disabled by tags, just make sure some file is left over that is not guarded by tags, such as doc.go.

Please let me know if this should be filed in another manner.

@ianlancetaylor
Copy link
Contributor

This issue was closed over two years ago. Please open a new issue for a problem you are encountering today. Thanks.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

5 participants