-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: build cache not updating when pkg-config files changed #24544
Comments
In order to invalidate the cache in this case, we would have to keep track of which external packages are linked into each test and rescan those packages whenever we rerun the test. It's not obvious to me how expensive that would be in order to catch a relatively rare source of cache invalidation from external dependencies. (See also #26366 (comment).) Perhaps @rsc has some insight. |
Since this was reported on 1.10, has a workaround ( |
In principle we could implement this by running However, we are currently adopting a general policy that changes to files outside the tree do not affect the build. For example, if Go code using cgo Based on that I think this is working as designed, so closing. |
I think this should at least be pointed out in the cgo docs. It seems non intuitive and nothing obvious hints that it would behave in such a way. |
@AlexRouSg It seems to me that this is already documented in the cmd/go docs, which say
|
My bad, haven't checked the docs in a while. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?linux amd64
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
Trying to run tests on a package that uses C libraries using pkg-config to set compile and linker flags when I changed the install location of the C libraries in a script which is how I noticed this.
go test mypkg
go test mypkg
move location of C library and update pkg-config file
go clean -testcache mypkg
go test mypkg
What did you expect to see?
ok mypkg 1.151s
ok mypkg (cached)
nothing from go clean
ok mypkg 1.151s
What did you see instead?
ok mypkg 1.151s
ok mypkg (cached)
nothing from go clean
For some reason it is important to run go test twice to get the cached result before moving the C library for it to fail. To test that it wasn't a bad config, running
go clean -cache -testcache mypkg
before testing clears the compile error./cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: