diff options
author | Bryan C. Mills <bcmills@google.com> | 2020-03-12 09:16:11 -0400 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2020-03-12 15:40:55 +0000 |
commit | e0f244d532a8b70a344c2e94abb852977e3fc9ea (patch) | |
tree | 36d8fda19ada4550b6bfc4584ac54cd352483ea7 | |
parent | 830b4f4075ebec82c7ed165819cc732d270f0850 (diff) | |
download | go-e0f244d532a8b70a344c2e94abb852977e3fc9ea.tar.gz go-e0f244d532a8b70a344c2e94abb852977e3fc9ea.zip |
[release-branch.go1.13] cmd/go: include the go language version in cache keys
Fixes #37821
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 c95708462fb24f379f4bcdedd6ea664ee38ea562)
Reviewed-on: https://go-review.googlesource.com/c/go/+/223142
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r-- | src/cmd/go/internal/work/exec.go | 3 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/mod_edit_go.txt | 7 |
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 7dd9a90c18..892e3cb500 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -208,6 +208,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { if !p.Goroot && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) { fmt.Fprintf(h, "dir %s\n", p.Dir) } + 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 |