]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/go/testdata/script/gotoolchain_modcmds.txt
64db6d9666c57fe7cec0930a719e8fca043185c6
[gostls13.git] / src / cmd / go / testdata / script / gotoolchain_modcmds.txt
1 env TESTGO_VERSION=go1.21.0
2 env TESTGO_VERSION_SWITCH=switch
3
4 # If the main module's go.mod file lists a version lower than the version
5 # required by its dependencies, the commands that fetch and diagnose the module
6 # graph (such as 'go mod download' and 'go mod graph') should fail explicitly:
7 # they can't interpret the graph themselves, and they aren't allowed to update
8 # the go.mod file to record a specific, stable toolchain version that can.
9
10 ! go mod download
11 stderr '^go: rsc.io/future@v1.0.0: module rsc.io/future@v1.0.0 requires go >= 1.999 \(running go 1.21.0\)'
12
13 ! go mod verify
14 stderr '^go: rsc.io/future@v1.0.0: module rsc.io/future@v1.0.0 requires go >= 1.999 \(running go 1.21.0\)'
15
16 ! go mod graph
17 stderr '^go: rsc.io/future@v1.0.0: module rsc.io/future@v1.0.0 requires go >= 1.999 \(running go 1.21.0\)'
18
19
20 # 'go get' should update the main module's go.mod file to a version compatible with the
21 # go version required for rsc.io/future, not fail.
22 go get .
23 stderr '^go: module rsc.io/future@v1.0.0 requires go >= 1.999; switching to go1.999testmod$'
24 stderr '^go: upgraded go 1.21 => 1.999$'
25 stderr '^go: added toolchain go1.999testmod$'
26
27
28 # Now, the various 'go mod' subcommands should succeed.
29
30 go mod download
31
32 go mod verify
33
34 go mod graph
35
36
37 -- go.mod --
38 module example
39
40 go 1.21
41
42 require rsc.io/future v1.0.0
43 -- example.go --
44 package example
45
46 import _ "rsc.io/future"