Commit 94f7795d authored by Russ Cox's avatar Russ Cox

cmd/go: fix experiment isolation in cache key

In general we don't assume that the go command knows the
specific version of the compiler being used, including which
experiments the compiler was built with. Let the compiler tell us,
instead of importing cmd/internal/objabi from cmd/go.

Replacement for CL 128735.

Change-Id: Iaa07f46e19764d0fb14a1c89979bea7bb7139b9c
Reviewed-on: https://go-review.googlesource.com/c/149338Reviewed-by: 's avatarBryan C. Mills <bcmills@google.com>
parent f53a9868
......@@ -18,7 +18,6 @@ import (
"cmd/go/internal/load"
"cmd/go/internal/str"
"cmd/internal/buildid"
"cmd/internal/objabi"
)
// Build IDs
......@@ -208,11 +207,6 @@ func (b *Builder) toolID(name string) string {
id = f[2]
}
// For the compiler, add any experiments.
if name == "compile" {
id += " " + objabi.Expstring()
}
b.id.Lock()
b.toolIDCache[name] = id
b.id.Unlock()
......
......@@ -100,9 +100,18 @@ func (versionFlag) Set(s string) error {
// for releases, but during development we include the full
// build ID of the binary, so that if the compiler is changed and
// rebuilt, we notice and rebuild all packages.
if s == "full" && strings.HasPrefix(Version, "devel") {
p += " buildID=" + buildID
if s == "full" {
// If there's an active experiment, include that,
// to distinguish go1.10.2 with an experiment
// from go1.10.2 without an experiment.
if x := Expstring(); x != "" {
p += " " + x
}
if strings.HasPrefix(Version, "devel") {
p += " buildID=" + buildID
}
}
fmt.Printf("%s version %s%s%s\n", name, Version, sep, p)
os.Exit(0)
return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment