...
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# GONOPROXY bypasses proxy
39[!net:rsc.io] skip
40[!git] skip
41env GOPRIVATE=none
42env GONOPROXY='*/fortune'
43! go get rsc.io/fortune # does not exist in real world, only on test proxy
44stderr 'git ls-remote'
45
46[!net:golang.org] skip
47env GOSUMDB=
48env GONOPROXY=
49env GOPRIVATE='*/x'
50go get golang.org/x/text
51go list -m all
52! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy
53
54-- go.mod.orig --
55module m
View as plain text