| 1 |
env GO111MODULE=on |
| 2 |
env sumdb=$GOSUMDB |
| 3 |
env proxy=$GOPROXY |
| 4 |
env GOPRIVATE GOPROXY GONOPROXY GOSUMDB GONOSUMDB |
| 5 |
env dbname=localhost.localdev/sumdb |
| 6 |
|
| 7 |
# disagree with sumdb fails |
| 8 |
cp go.mod.orig go.mod |
| 9 |
env GOSUMDB=$sumdb' '$proxy/sumdb-wrong |
| 10 |
! go get rsc.io/quote |
| 11 |
stderr 'SECURITY ERROR' |
| 12 |
|
| 13 |
# GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text |
| 14 |
env GONOSUMDB='*/quote,*/*mple*,golang.org/x' |
| 15 |
go get rsc.io/quote |
| 16 |
rm go.sum |
| 17 |
env GOPRIVATE='*/quote,*/*mple*,golang.org/x' |
| 18 |
env GONOPROXY=none # that is, proxy all despite GOPRIVATE |
| 19 |
go 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. |
| 24 |
go list -m all |
| 25 |
stdout '^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. |
| 28 |
env GOPROXY=',' |
| 29 |
! go get golang.org/x/text |
| 30 |
stderr '^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. |
| 33 |
env GONOPROXY=*/fortune |
| 34 |
env GOPROXY=off |
| 35 |
! go get golang.org/x/text |
| 36 |
stderr '^go: golang.org/x/text: module lookup disabled by GOPROXY=off$' |
| 37 |
|
| 38 |
# GONOPROXY bypasses proxy |
| 39 |
[!net:rsc.io] skip |
| 40 |
[!git] skip |
| 41 |
env GOPRIVATE=none |
| 42 |
env GONOPROXY='*/fortune' |
| 43 |
! go get rsc.io/fortune # does not exist in real world, only on test proxy |
| 44 |
stderr 'git ls-remote' |
| 45 |
|
| 46 |
[!net:golang.org] skip |
| 47 |
env GOSUMDB= |
| 48 |
env GONOPROXY= |
| 49 |
env GOPRIVATE='*/x' |
| 50 |
go get golang.org/x/text |
| 51 |
go list -m all |
| 52 |
! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy |
| 53 |
|
| 54 |
-- go.mod.orig -- |
| 55 |
module m |