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

     1  env TESTGO_VERSION=go1.21
     2  env TESTGO_VERSION_SWITCH=switch
     3  
     4  # Control case: get module@version should switch toolchain versions.
     5  cp go.mod.orig go.mod
     6  go get example.com/increasegoreq@v0.0.2
     7  stderr 'go: module example.com/increasegoreq@v0.0.2 requires go >= 1.23; switching to go1.23.9'
     8  cmp go.mod go.mod.want
     9  
    10  # #79917: get ./... should also switch toolchain versions.
    11  cp go.mod.orig go.mod
    12  go get -u ./...
    13  stderr 'go: module example.com/increasegoreq@v0.0.2 requires go >= 1.23; switching to go1.23.9'
    14  cmp go.mod go.mod.want
    15  
    16  # go get -u without arguments (default to .) should also switch toolchains
    17  cp go.mod.orig go.mod
    18  go get -u
    19  stderr 'go: module example.com/increasegoreq@v0.0.2 requires go >= 1.23; switching to go1.23.9'
    20  cmp go.mod go.mod.want
    21  
    22  -- go.mod.orig --
    23  module m
    24  
    25  go 1.21
    26  
    27  require example.com/increasegoreq v0.0.1
    28  -- go.mod.want --
    29  module m
    30  
    31  go 1.23
    32  
    33  require example.com/increasegoreq v0.0.2
    34  -- main.go --
    35  package main
    36  
    37  import _ "example.com/increasegoreq"
    38  
    39  func main() {}
    40  

View as plain text