...
1env GO111MODULE=on
2env sumdb=$GOSUMDB
3env proxy=$GOPROXY
4env GOPRIVATE GOPROXY GONOPROXY GOSUMDB GONOSUMDB
5env dbname=localhost.localdev/sumdb
6
7# disagree with sumdb fails
8cp go.mod.orig go.mod
9env GOSUMDB=$sumdb' '$proxy/sumdb-wrong
10! go get rsc.io/quote
11stderr 'SECURITY ERROR'
12
13# GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text
14env GONOSUMDB='*/quote,*/*mple*,golang.org/x'
15go get rsc.io/quote
16rm go.sum
17env GOPRIVATE='*/quote,*/*mple*,golang.org/x'
18env GONOPROXY=none # that is, proxy all despite GOPRIVATE
19go get rsc.io/quote
20
21# Download .info files needed for 'go list -m all' later.
22# TODO(#42723): either 'go list -m' should not read these files,
23# or 'go get' and 'go mod tidy' should download them.
24go list -m all
25stdout '^golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c$'
26
27# When GOPROXY is not empty but contains no entries, an error should be reported.
28env GOPROXY=','
29! go get golang.org/x/text
30stderr '^go: golang.org/x/text: GOPROXY list is not the empty string, but contains no entries$'
31
32# When GOPROXY=off, fetching modules not matched by GONOPROXY fails.
33env GONOPROXY=*/fortune
34env GOPROXY=off
35! go get golang.org/x/text
36stderr '^go: golang.org/x/text: module lookup disabled by GOPROXY=off$'
37
38[short] skip 'the rest of the test uses git'
39
40# GONOPROXY bypasses proxy
41[!git] skip
42env GOPROXY=$proxy
43env GOSUMDB=$sumdb
44env GOPRIVATE=none
45env GONOPROXY='*/git/proxyonly.git'
46! go get vcs-test.golang.org/git/proxyonly.git # does not exist in vcstest, only on test proxy
47stderr 'git ls-remote'
48
49env GOSUMDB=off
50env GONOPROXY=
51env GOPRIVATE='*/git/tagtests.git'
52go get vcs-test.golang.org/git/tagtests.git
53go list -m all
54stdout '^vcs-test.golang.org/git/tagtests.git v0.2.2$'
55! stdout 'tagtests.git v0.1.0' # should not have the version from the proxy
56
57-- go.mod.orig --
58module m
View as plain text