...
1env TESTGO_VERSION=go1.14
2
3# Clear the path so this test doesn't fail if the system running it\
4# has a binary named go1.21 or go1.22 on its path.
5[GOOS:plan9] env path=
6[!GOOS:plan9] env PATH=
7
8# check for invalid toolchain in go.mod
9go mod init m
10go mod edit -go=1.14 -toolchain=go1.22
11! go version
12stderr 'go: invalid toolchain: go1.22 is a language version but not a toolchain version \(go1.22.x\)'
13
14rm go.mod
15go mod init m
16go mod edit -go=1.14 -toolchain=go1.21
17! go version
18stderr 'go: invalid toolchain: go1.21 is a language version but not a toolchain version \(go1.21.x\)'
19
20rm go.mod
21go mod init m
22go mod edit -go=1.14 -toolchain=go1.20
23! go version
24stderr 'go: downloading go1.20 '
25
26
27# check for invalid GOTOOLCHAIN
28env GOTOOLCHAIN=go1.14
29go version
30stdout 'go1.14'
31
32env GOTOOLCHAIN=go1.20
33! go version
34stderr 'go: downloading go1.20 '
35
36env GOTOOLCHAIN=go1.21
37! go version
38stderr 'go: invalid toolchain: go1.21 is a language version but not a toolchain version \(go1.21.x\)'
39
40env GOTOOLCHAIN=go1.22
41! go version
42stderr 'go: invalid toolchain: go1.22 is a language version but not a toolchain version \(go1.22.x\)'
43
44env GOTOOLCHAIN=go1.20+auto
45! go version
46stderr 'go: downloading go1.20 '
47
48env GOTOOLCHAIN=go1.21+auto
49! go version
50stderr 'go: invalid toolchain: go1.21 is a language version but not a toolchain version \(go1.21.x\)'
51
52env GOTOOLCHAIN=go1.22+auto
53! go version
54stderr 'go: invalid toolchain: go1.22 is a language version but not a toolchain version \(go1.22.x\)'
55
56env GOTOOLCHAIN=go1.21rc3
57! go version
58stderr 'go: downloading go1.21rc3 '
59
60env GOTOOLCHAIN=go1.22rc2
61! go version
62stderr 'go: downloading go1.22rc2 '
63
64env GOTOOLCHAIN=go1.66
65! go version
66stderr 'go: invalid toolchain: go1.66 is a language version but not a toolchain version \(go1.66.x\)'
67
68env GOTOOLCHAIN=go1.18beta2
69! go version
70stderr 'go: downloading go1.18beta2 '
71
72# go1.X is okay for path lookups
73env GOTOOLCHAIN=go1.20+path
74! go version
75stderr 'go: cannot find "go1.20" in PATH'
76
77env GOTOOLCHAIN=go1.21+path
78! go version
79stderr 'go: cannot find "go1.21" in PATH'
80
81env GOTOOLCHAIN=go1.22+path
82! go version
83stderr 'go: cannot find "go1.22" in PATH'
84
85# When a toolchain download takes place, download 1.X.0
86env GOTOOLCHAIN=auto
87rm go.mod
88go mod init m
89go mod edit -go=1.300 -toolchain=none
90! go version
91stderr 'go: downloading go1.300.0 '
92
93rm go.mod
94go mod init m
95go mod edit -go=1.21 -toolchain=none
96! go version
97stderr 'go: downloading go1.21.0 '
98
99rm go.mod
100go mod init m
101go mod edit -go=1.22 -toolchain=none
102! go version
103stderr 'go: downloading go1.22.0 '
104
105rm go.mod
106go mod init m
107go mod edit -go=1.15 -toolchain=none
108! go version
109stderr 'go: downloading go1.15 '
View as plain text