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 fails to detect changes in build flags when deciding whether or not to update a binary #3832

Closed
gopherbot opened this issue Jul 16, 2012 · 15 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@gopherbot
Copy link

by douglas@mayle.org:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Create the directory $GOHOME/src/install_error and create the two files:
cat >main_notag.go << EOF
// +build !tag

package main

import "fmt"

func main() {
  fmt.Println("No tag build.")
}
EOF

cat >main_tag.go << EOF
// +build tag

package main

import "fmt"

func main() {
  fmt.Println("Tag build.")
}
EOF

2. go install install_error
3. go install -tags tag install_error

What is the expected output?
"Tag build."

What do you see instead?
"No tag build."

Which compiler are you using (5g, 6g, 8g, gccgo)?
This is darwin 32-bit, which I guess makes it 6g?  I installed go from source

Which operating system are you using?
OSX

Which version are you using?  (run 'go version')
go version weekly.2012-03-27 +695f65745351

Please provide any additional information below.
Whenever you change source files, go install will correctly update the binary on disk. 
If you change build tags, however, even though it might make for a change in binary, the
install is abandoned.
@robpike
Copy link
Contributor

robpike commented Jul 16, 2012

Comment 1:

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

Owner changed to @rsc.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 2:

Not sure how this could work, unless we start looking inside binaries. I suppose that
would solve the 'deleted a file' problem too.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 3:

Labels changed: added go1.1.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 4:

Labels changed: added size-l.

@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 5:

Labels changed: added go1.1maybe, removed go1.1.

@robpike
Copy link
Contributor

robpike commented May 18, 2013

Comment 6:

Labels changed: added go1.2maybe, removed go1.1maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 7:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 29, 2013

Comment 8:

Won't happen for 1.2.

Labels changed: removed go1.2maybe.

@gopherbot
Copy link
Author

Comment 9:

The hash idea from #3895 would probably solve this too, if the tags are included in the
hash.
https://golang.org/issue/3895?c=13

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 10:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 11:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 12:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 13:

Labels changed: added repo-main.

@ianlancetaylor
Copy link
Contributor

Comment 14:

Labels changed: added suggested, removed priority-later.

@gopherbot gopherbot added accepted Suggested Issues that may be good for new contributors looking for work to do. labels Apr 2, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc modified the milestones: Go1.5Maybe, Unplanned Apr 20, 2015
@rsc
Copy link
Contributor

rsc commented Jun 29, 2015

The general case of build flags like -gcflags is still not handled, but the case you gave of install tags is fixed for Go 1.5.

@rsc rsc closed this as completed Jun 29, 2015
@golang golang locked and limited conversation to collaborators Jun 28, 2016
@rsc rsc removed their assignment Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

4 participants