...
1# Adding a tool upgrades the toolchain to 1.24.0 because older go
2# versions fail to parse the tool directive. Issue #74739.
3cp go.mod.go1.23.0 go.mod
4go get -tool ./mytool
5stderr 'go: upgraded go 1.23.0 => 1.24'
6cmp go.mod go.mod.go1.24
7go mod tidy
8cmp go.mod go.mod.go1.24
9
10# No toolchain change if go >= 1.24.0
11cp go.mod.go1.24 go.mod
12cmp go.mod go.mod.go1.24
13go get -tool ./mytool
14cmp go.mod go.mod.go1.24
15go mod tidy
16cmp go.mod go.mod.go1.24
17
18# TODO(#78550): If #78550 is approved, go build should reject
19# the go.mod file if go < 1.24 but there is a tool directive.
20# For now, we will let it through.
21cp go.mod.go1.23.0 go.mod
22go list ./mytool
23go build -n ./mytool
24
25-- go.mod.go1.23.0 --
26module m
27
28go 1.23.0
29
30tool m/mytool
31-- go.mod.go1.24 --
32module m
33
34go 1.24
35
36tool m/mytool
37-- mytool/mytool.go --
38package mytool
39
40func main() {}
View as plain text