...
1env TESTGO_VERSION=go1.21
2env TESTGO_VERSION_SWITCH=switch
3
4# Control case: get module@version should switch toolchain versions.
5cp go.mod.orig go.mod
6go get example.com/increasegoreq@v0.0.2
7stderr 'go: module example.com/increasegoreq@v0.0.2 requires go >= 1.23; switching to go1.23.9'
8cmp go.mod go.mod.want
9
10# #79917: get ./... should also switch toolchain versions.
11cp go.mod.orig go.mod
12go get -u ./...
13stderr 'go: module example.com/increasegoreq@v0.0.2 requires go >= 1.23; switching to go1.23.9'
14cmp go.mod go.mod.want
15
16# go get -u without arguments (default to .) should also switch toolchains
17cp go.mod.orig go.mod
18go get -u
19stderr 'go: module example.com/increasegoreq@v0.0.2 requires go >= 1.23; switching to go1.23.9'
20cmp go.mod go.mod.want
21
22-- go.mod.orig --
23module m
24
25go 1.21
26
27require example.com/increasegoreq v0.0.1
28-- go.mod.want --
29module m
30
31go 1.23
32
33require example.com/increasegoreq v0.0.2
34-- main.go --
35package main
36
37import _ "example.com/increasegoreq"
38
39func main() {}
View as plain text