...
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.
7env GOEXPERIMENT=''
8
9env TESTGO_VERSION=go1.21actual
10
11# GOTOOLCHAIN from network, does not exist
12env GOTOOLCHAIN=go1.9999x
13! go version
14stderr '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'
18env GOTOOLCHAIN=go1.999testmod
19go version
20stderr 'go: downloading go1.999testmod \(.*/.*\)'
21
22# GOTOOLCHAIN cached from network
23go version
24! stderr downloading
25stdout go1.999testmod
26
27# GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should operate in cache and not try badurl
28env oldsumdb=$GOSUMDB
29env GOSUMDB=$oldsumdb' http://badurl'
30go version
31! stderr downloading
32stdout go1.999testmod
33
34# GOTOOLCHAIN with GOSUMB=off should fail, because it cannot access even the cached sumdb info
35# without the sumdb name.
36env GOSUMDB=off
37! go version
38stderr '^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
41env GOSUMDB=$oldsumdb' http://badurl'
42rm $GOPATH/pkg/mod/cache/download/sumdb
43! go version
44! stderr downloading
45stderr 'panic: use of network' # test catches network access
46env GOSUMDB=$oldsumdb
47
View as plain text