]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.14] cmd/go: include the go language version in cache keys
authorBryan C. Mills <bcmills@google.com>
Thu, 12 Mar 2020 13:16:11 +0000 (09:16 -0400)
committerDmitri Shuralyov <dmitshur@golang.org>
Thu, 12 Mar 2020 15:38:41 +0000 (15:38 +0000)
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>
src/cmd/go/internal/work/exec.go
src/cmd/go/testdata/script/mod_edit_go.txt

index 1bba3a5329fc8b734e73c247f15c3fd4f21af349..25d15079e4f7a24cac9de3a7e3d44b2797d4a6a8 100644 (file)
@@ -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)
index 3ec8137e2d313044344d1ada6e6b3cb2ba231570..38321d071fb35e9adf1c8664f9c7de6edfab9549 100644 (file)
@@ -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