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