...

Text file src/cmd/go/testdata/script/mod_get_exec_toolchain.txt

Documentation: cmd/go/testdata/script

     1env TESTGO_VERSION=go1.21
     2env TESTGO_VERSION_SWITCH=switch
     3
     4# GOTOOLCHAIN=auto should run the newer toolchain
     5env GOTOOLCHAIN=auto
     6cp go.mod.new go.mod
     7go get rsc.io/needgo121 rsc.io/needgo122 rsc.io/needgo123 rsc.io/needall
     8stderr '^go: rsc.io/needall@v0.0.1 requires go >= 1.23; switching to go1.23.9$'
     9! stderr '\(running'
    10stderr '^go: added rsc.io/needall v0.0.1'
    11grep 'go 1.23' go.mod
    12grep 'toolchain go1.23.9' go.mod
    13
    14# GOTOOLCHAIN=min+auto should run the newer toolchain
    15env GOTOOLCHAIN=go1.21+auto
    16cp go.mod.new go.mod
    17go get rsc.io/needgo121 rsc.io/needgo122 rsc.io/needgo123 rsc.io/needall
    18stderr '^go: rsc.io/needall@v0.0.1 requires go >= 1.23; switching to go1.23.9$'
    19! stderr '\(running'
    20stderr '^go: added rsc.io/needall v0.0.1'
    21grep 'go 1.23' go.mod
    22grep 'toolchain go1.23.9' go.mod
    23
    24# GOTOOLCHAIN=go1.21 should NOT run the newer toolchain
    25env GOTOOLCHAIN=go1.21
    26cp go.mod.new go.mod
    27! go get rsc.io/needgo121 rsc.io/needgo122 rsc.io/needgo123 rsc.io/needall
    28! stderr switching
    29stderr 'rsc.io/needgo122@v0.0.1 requires go >= 1.22'
    30stderr 'rsc.io/needgo123@v0.0.1 requires go >= 1.23'
    31stderr 'rsc.io/needall@v0.0.1 requires go >= 1.23'
    32stderr 'requires go >= 1.23'
    33! stderr 'requires go >= 1.21' # that's us!
    34cmp go.mod go.mod.new
    35
    36# GOTOOLCHAIN=local should NOT run the newer toolchain
    37env GOTOOLCHAIN=local
    38cp go.mod.new go.mod
    39! go get rsc.io/needgo121 rsc.io/needgo122 rsc.io/needgo123 rsc.io/needall
    40! stderr switching
    41stderr 'rsc.io/needgo122@v0.0.1 requires go >= 1.22'
    42stderr 'rsc.io/needgo123@v0.0.1 requires go >= 1.23'
    43stderr 'rsc.io/needall@v0.0.1 requires go >= 1.23'
    44stderr 'requires go >= 1.23'
    45! stderr 'requires go >= 1.21' # that's us!
    46cmp go.mod go.mod.new
    47
    48# go get go@1.22 should resolve to the latest 1.22
    49env GOTOOLCHAIN=local
    50cp go.mod.new go.mod
    51! go get go@1.22
    52stderr '^go: updating go.mod requires go >= 1.22.9 \(running go 1.21; GOTOOLCHAIN=local\)'
    53
    54env GOTOOLCHAIN=auto
    55cp go.mod.new go.mod
    56go get go@1.22
    57stderr '^go: updating go.mod requires go >= 1.22.9; switching to go1.22.9$'
    58
    59# go get go@1.22rc1 should use 1.22rc1 exactly, not a later release.
    60env GOTOOLCHAIN=local
    61cp go.mod.new go.mod
    62! go get go@1.22rc1
    63stderr '^go: updating go.mod requires go >= 1.22rc1 \(running go 1.21; GOTOOLCHAIN=local\)'
    64
    65env GOTOOLCHAIN=auto
    66cp go.mod.new go.mod
    67go get go@1.22rc1
    68stderr '^go: updating go.mod requires go >= 1.22rc1; switching to go1.22.9$'
    69stderr '^go: upgraded go 1.1 => 1.22rc1$'
    70stderr '^go: added toolchain go1.22.9$'
    71
    72# go get go@1.22.1 should use 1.22.1 exactly, not a later release.
    73env GOTOOLCHAIN=local
    74cp go.mod.new go.mod
    75! go get go@1.22.1
    76stderr '^go: updating go.mod requires go >= 1.22.1 \(running go 1.21; GOTOOLCHAIN=local\)'
    77
    78env GOTOOLCHAIN=auto
    79cp go.mod.new go.mod
    80go get go@1.22.1
    81stderr '^go: updating go.mod requires go >= 1.22.1; switching to go1.22.9$'
    82stderr '^go: upgraded go 1.1 => 1.22.1$'
    83stderr '^go: added toolchain go1.22.9$'
    84
    85# go get needgo122 (says 'go 1.22') should use 1.22.0, the earliest release we have available
    86# (ignoring prereleases).
    87env GOTOOLCHAIN=local
    88cp go.mod.new go.mod
    89! go get rsc.io/needgo122
    90stderr '^go: rsc.io/needgo122@v0.0.1 requires go >= 1.22 \(running go 1.21; GOTOOLCHAIN=local\)'
    91
    92env GOTOOLCHAIN=auto
    93cp go.mod.new go.mod
    94go get rsc.io/needgo122
    95stderr '^go: upgraded go 1.1 => 1.22$'
    96stderr '^go: rsc.io/needgo122@v0.0.1 requires go >= 1.22; switching to go1.22.9$'
    97stderr '^go: added toolchain go1.22.9$'
    98
    99# go get needgo1223 (says 'go 1.22.3') should use go 1.22.3
   100env GOTOOLCHAIN=local
   101cp go.mod.new go.mod
   102! go get rsc.io/needgo1223
   103stderr '^go: rsc.io/needgo1223@v0.0.1 requires go >= 1.22.3 \(running go 1.21; GOTOOLCHAIN=local\)'
   104
   105env GOTOOLCHAIN=auto
   106cp go.mod.new go.mod
   107go get rsc.io/needgo1223
   108stderr '^go: upgraded go 1.1 => 1.22.3$'
   109stderr '^go: rsc.io/needgo1223@v0.0.1 requires go >= 1.22.3; switching to go1.22.9$'
   110stderr '^go: added toolchain go1.22.9$'
   111
   112# go get needgo124 (says 'go 1.24') should use go 1.24rc1, the only version available
   113env GOTOOLCHAIN=local
   114cp go.mod.new go.mod
   115! go get rsc.io/needgo124
   116stderr '^go: rsc.io/needgo124@v0.0.1 requires go >= 1.24 \(running go 1.21; GOTOOLCHAIN=local\)'
   117
   118env GOTOOLCHAIN=auto
   119cp go.mod.new go.mod
   120go get rsc.io/needgo124
   121stderr '^go: rsc.io/needgo124@v0.0.1 requires go >= 1.24; switching to go1.24rc1$'
   122stderr '^go: upgraded go 1.1 => 1.24$'
   123stderr '^go: added toolchain go1.24rc1$'
   124
   125# The -C flag should not happen more than once due to switching.
   126mkdir dir dir/dir
   127cp go.mod.new go.mod
   128cp go.mod.new dir/go.mod
   129cp go.mod.new dir/dir/go.mod
   130cp p.go dir/p.go
   131cp p.go dir/dir/p.go
   132go get -C dir rsc.io/needgo124
   133stderr '^go: rsc.io/needgo124@v0.0.1 requires go >= 1.24; switching to go1.24rc1$'
   134stderr '^go: upgraded go 1.1 => 1.24$'
   135stderr '^go: added toolchain go1.24rc1$'
   136cmp go.mod.new go.mod
   137cmp go.mod.new dir/dir/go.mod
   138grep 'go 1.24$' dir/go.mod
   139
   140-- go.mod.new --
   141module m
   142go 1.1
   143
   144-- p.go --
   145package p

View as plain text