Skip to content

Commit c957084

Browse files
author
Bryan C. Mills
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent 139a79d commit c957084

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/cmd/go/internal/work/exec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
213213
} else if cfg.BuildTrimpath && p.Module != nil {
214214
fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
215215
}
216+
if p.Module != nil {
217+
fmt.Fprintf(h, "go %s", p.Module.GoVersion)
218+
}
216219
fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
217220
fmt.Fprintf(h, "import %q\n", p.ImportPath)
218221
fmt.Fprintf(h, "omitdebug %v standard %v local %v prefix %q\n", p.Internal.OmitDebug, p.Standard, p.Internal.Local, p.Internal.LocalPrefix)

src/cmd/go/testdata/script/mod_edit_go.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ go mod edit -go=1.9
77
grep 'go 1.9' go.mod
88
go build
99

10+
# Reverting the version should force a rebuild and error instead of using
11+
# the cached 1.9 build. (https://golang.org/issue/37804)
12+
go mod edit -go=1.8
13+
! go build
14+
stderr 'type aliases only supported as of'
15+
16+
1017
-- go.mod --
1118
module m
1219
go 1.8

0 commit comments

Comments
 (0)