1 # Go should refuse to build code that is too new according to go.mod.
2
3 # go.mod too new
4 env GOTOOLCHAIN=local
5 ! go build .
6 stderr '^go: go.mod requires go >= 1.99999 \(running go 1\..+\)$'
7
8 # go.mod referenced from go.work too new
9 cp go.work.old go.work
10 ! go build .
11 stderr '^go: module . listed in go.work file requires go >= 1.99999, but go.work lists go 1.10; to update it:\n\tgo work use$'
12
13 ! go work sync
14 stderr '^go: cannot load module . listed in go.work file: go.mod requires go >= 1.99999 \(running go 1\..+\)$'
15
16 # go.work too new
17 cp go.work.new go.work
18 cp go.mod.old go.mod
19 ! go build .
20 stderr '^go: go.work requires go >= 1.99999 \(running go 1\..+\)$'
21
22 # vendor too new
23 rm go.work
24 mv notvendor vendor
25 ! go build -mod=vendor .
26 stderr '^go: golang.org/x/text in vendor'${/}'modules.txt requires go >= 1.99999 \(running go 1\..+\)$'
27
28 -- go.mod --
29 module example
30 go 1.99999
31
32 -- p.go --
33 package p
34
35 -- go.mod.old --
36 module example
37 go 1.10
38
39 -- go.work.new --
40 go 1.99999
41 use .
42
43 -- go.work.old --
44 go 1.10
45 use .
46
47 -- notvendor/modules.txt --
48 # golang.org/x/text v0.9.0
49 ## explicit; go 1.99999
50 golang.org/x/text/internal/language
51
View as plain text