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

     1  # This test only checks that basic network lookups work.
     2  # The full test of toolchain version selection is in gotoolchain.txt.
     3  
     4  # This test is sensitive to "new" Go experiments, so
     5  # update the environment to remove any existing GOEXPERIMENT
     6  # setting, see #62016 for more on this.
     7  env GOEXPERIMENT=''
     8  
     9  env TESTGO_VERSION=go1.21actual
    10  
    11  # GOTOOLCHAIN from network, does not exist
    12  env GOTOOLCHAIN=go1.9999x
    13  ! go version
    14  stderr 'go: download go1.9999x for .*: toolchain not available'
    15  
    16  # GOTOOLCHAIN from network
    17  [!exec:/bin/sh] stop 'the fake proxy serves shell scripts instead of binaries'
    18  env GOTOOLCHAIN=go1.999testmod
    19  go version
    20  stderr 'go: downloading go1.999testmod \(.*/.*\)'
    21  
    22  # GOTOOLCHAIN cached from network
    23  go version
    24  ! stderr downloading
    25  stdout go1.999testmod
    26  
    27  # GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should operate in cache and not try badurl
    28  env oldsumdb=$GOSUMDB
    29  env GOSUMDB=$oldsumdb' http://badurl'
    30  go version
    31  ! stderr downloading
    32  stdout go1.999testmod
    33  
    34  # GOTOOLCHAIN with GOSUMB=off should fail, because it cannot access even the cached sumdb info
    35  # without the sumdb name.
    36  env GOSUMDB=off
    37  ! go version
    38  stderr '^go: golang.org/toolchain@v0.0.1-go1.999testmod.[a-z0-9\-]*: verifying module: checksum database disabled by GOSUMDB=off$'
    39  
    40  # GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should fail if cache is incomplete
    41  env GOSUMDB=$oldsumdb' http://badurl'
    42  rm $GOPATH/pkg/mod/cache/download/sumdb
    43  ! go version
    44  ! stderr downloading
    45  stderr 'panic: use of network' # test catches network access
    46  env GOSUMDB=$oldsumdb
    47  
    48  

View as plain text