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: cache conflict with compiler experiment flags #33091

Closed
dsnet opened this issue Jul 12, 2019 · 2 comments
Closed

cmd/go: cache conflict with compiler experiment flags #33091

dsnet opened this issue Jul 12, 2019 · 2 comments
Assignees
Milestone

Comments

@dsnet
Copy link
Member

@dsnet dsnet commented Jul 12, 2019

This is a re-issue of #26883, which was fixed and then broken again.

There seems to be cache conflict where the compiler experiment is not part of the hash.

Steps to reproduce:

# Download the Go toolchain.
mkdir /tmp/cache-conflict
export GOCACHE=/tmp/cache-conflict/cache # clean cache for reproduction purposes
(cd /tmp/cache-conflict/ && curl -s -L https://dl.google.com/go/go1.12.7.src.tar.gz | tar -zxf -)

# Build the Go toolchain normally and use that to build some random target.
(cd /tmp/cache-conflict/go/src && ./make.bash)
/tmp/cache-conflict/go/bin/go build -race archive/tar

# Build the Go toolchain with fieldtracking support and use that to build the same target again.
(cd /tmp/cache-conflict/go/src && GOEXPERIMENT=fieldtrack ./make.bash)
/tmp/cache-conflict/go/bin/go build -race archive/tar

The last command fails with:

# runtime
/tmp/cache-conflict/go/src/runtime/alg.go:8:2: import /tmp/cache-conflict/cache/28/2829dcccd09b7c1ac1694d626da6e06a28de4470a18c47b518bc0236aa533c48-d: object is [darwin amd64 go1.12.7 X:framepointer
] expected [darwin amd64 go1.12.7 X:fieldtrack,framepointer
]

\cc @rsc @ianlancetaylor

@dmitshur dmitshur added this to the Go1.13 milestone Jul 14, 2019
@dmitshur dmitshur added the GoCommand label Jul 14, 2019
@jayconrod

This comment has been minimized.

Copy link
Contributor

@jayconrod jayconrod commented Jul 15, 2019

It looks like the most recent change here was CL 149338. The go command invokes the compiler with -V=full to get the version. For a released version, the output looks like:

compile version go1.13beta1 X:framepointer

For a released version, the Go command only includes the version in the tool ID. It should include the version and everything after.

For a development version, it will include the content ID (stamped SHA-256) of the binary, so that shouldn't be a problem.

@jayconrod jayconrod self-assigned this Jul 15, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 15, 2019

Change https://golang.org/cl/186200 mentions this issue: cmd/go: include GOEXPERIMENT flags in tool id for cache key

@gopherbot gopherbot closed this in 4814e7d Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.