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: argument "-tags" doesn't trigger rebuild even if tags are different from last build #11165
Comments
I think the work that @rsc is doing with content-addressable build objects will solve this issue. |
This bug report doesn't include which version of Go that @hydroflame was using. This might've already been fixed in 119daba or 7b87631 on April 20th. |
|
Seems likely that it is fixed at HEAD. Closing the issue until someone reports otherwise. |
Have you tried Go 1.5 (tip)? I think the issue has been fixed. Update: confirmed fixed at tip. |
Prior to 1.5, Go fails to rebuild binaries when tags change: golang/go#11165 The only safe way to build is to force Go to rebuild everything, every time. Note that "when tags change" is a tricky concept. If you run `go get`, you just did an implicit build with no tags. So if you run `go build -tags foo` immediately after, *your tags have changed*, even though you think you only did one build. Your "clean" GOPATH is not safe!
I just ran into this building on Debian (go1.3.3). This bug can even affect build machines that try to use a clean GOPATH, if they use |
So if you setup a project that has some file that use
-tags
argument. reinstalling/building will not trigger a rebuild of the library even if the
-tags
provided are different from the last buildto reproduce:
define 2 files in a package, each one with a function that returns a different value
eg.
then make some simple main that simply calls this function and prints the result
then compile the library
$ go install thebug
//should build with the!alice
version$ go run main.go
false
$ go install -tags alice thebug
$ go run main.go
false
notice that
thebug
was not recompiled (because no files changed) the only workaround i found was to build using the-a
flag but that's a pain when the library you're compiling import many other library.The text was updated successfully, but these errors were encountered: