1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:50:06 -07:00

cmd/go: include the go language version in cache keys

Fixes #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>
This commit is contained in:
Bryan C. Mills 2020-03-12 09:16:11 -04:00
parent 139a79dc37
commit c95708462f
2 changed files with 10 additions and 0 deletions

View 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", 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)

View 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