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: use package source hash to detect stale cached compiled packages? #14976
Comments
@minux, can you help triage this? |
Basically bronze1man complains that our pkg cache uses
file timestamp to detect stale compiled packages and on
OS X's HFS+ file system, the granularity of file timestamp
is only 1s, so sometimes cmd/go won't be able to detect
stale compiled packages.
bronze1man proposes that we also use file content hash
to detect stale compiled packages.
|
In that case, this is a dup of #4719. Part of solving #4719 (which I desperately want, but doesn't fit into the Go 1.7 cycle with people's time) and having a reliable cache is making sure it's a proper 100% accurate cache, which would necessarily involve making things based on content and not modtime. |
@bradfitz So I have to wait to go 1.8 to get the 100% accurate cache? I am planing of writing my accurate cache "go install" implement using go install command.
|
Or Go 1.9 or Go 1.10. Nobody has committed to working on it, and nobody has a design document or CL yet. |
Fixed now on master, will be in Go 1.10. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.6 darwin/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
I write a main package and a library package and a tester main package.
Sorry, I missing some library in the code.I think you guys may guess what they are doing.
testerWithPkg use go install.
testerWithPath use go run .
I want to change the pkgLibA code and go run and go install can see the change immediately.
I found that I need to add following code or delete pkg directory to make go run and go install notice that I change the pkgLibA code.
I guess your guys use modified time from the Lstat syscall for file content cache verification. I got the same result when I only use Lstat syscall for file content cache verification on darwin.
I found two solutions to get correct behavior to this kind of problem:
As you can see from the example implement code, if you make file content verification to a standalone library , you only need to compute the md5 sum of the file content when the changes,if it does not change,you can use the old md5 sum safely, and the most of the source code files do not change during the develop process.
The text was updated successfully, but these errors were encountered: