aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2020-03-12 09:16:11 -0400
committerDmitri Shuralyov <dmitshur@golang.org>2020-03-12 15:38:41 +0000
commitadba22a9ae10fa58704ee75bd6d7c8086df35350 (patch)
tree0cb63c04e65cfc38d8ab6a211a315c541fd85001
parentfd85ff5ee0b0c999da59e5f56237070e1aad2df3 (diff)
downloadgo-adba22a9ae10fa58704ee75bd6d7c8086df35350.tar.gz
go-adba22a9ae10fa58704ee75bd6d7c8086df35350.zip
[release-branch.go1.14] cmd/go: include the go language version in cache keys
Fixes #37822 Updates #37804 Change-Id: I4381dc5c58cfd467506d3d73fbd19c2c7257338e Reviewed-on: https://go-review.googlesource.com/c/go/+/223139 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from commit feea3f165770025b045c6dd46747b1debdaf348e) Reviewed-on: https://go-review.googlesource.com/c/go/+/223141 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r--src/cmd/go/internal/work/exec.go3
-rw-r--r--src/cmd/go/testdata/script/mod_edit_go.txt7
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
index 1bba3a5329..25d15079e4 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
@@ -213,6 +213,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
} else if cfg.BuildTrimpath && p.Module != nil {
fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
}
+ if p.Module != nil {
+ fmt.Fprintf(h, "go %s\n", p.Module.GoVersion)
+ }
fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
fmt.Fprintf(h, "import %q\n", p.ImportPath)
fmt.Fprintf(h, "omitdebug %v standard %v local %v prefix %q\n", p.Internal.OmitDebug, p.Standard, p.Internal.Local, p.Internal.LocalPrefix)
diff --git a/src/cmd/go/testdata/script/mod_edit_go.txt b/src/cmd/go/testdata/script/mod_edit_go.txt
index 3ec8137e2d..38321d071f 100644
--- a/src/cmd/go/testdata/script/mod_edit_go.txt
+++ b/src/cmd/go/testdata/script/mod_edit_go.txt
@@ -7,6 +7,13 @@ go mod edit -go=1.9
grep 'go 1.9' go.mod
go build
+# Reverting the version should force a rebuild and error instead of using
+# the cached 1.9 build. (https://golang.org/issue/37804)
+go mod edit -go=1.8
+! go build
+stderr 'type aliases only supported as of'
+
+
-- go.mod --
module m
go 1.8