Commit d021dd6a authored by Russ Cox's avatar Russ Cox

cmd/go: add test of $GONOPROXY, $GONOSUMDB behavior

Change-Id: I8a4917ce14ea22d5991226e485d43a9c9312950e
Reviewed-on: https://go-review.googlesource.com/c/go/+/174219
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
parent ee59c06a
...@@ -111,6 +111,8 @@ func (ts *testScript) setup() { ...@@ -111,6 +111,8 @@ func (ts *testScript) setup() {
"GOPROXY=" + proxyURL, "GOPROXY=" + proxyURL,
"GOROOT=" + testGOROOT, "GOROOT=" + testGOROOT,
"GOSUMDB=" + testSumDBVerifierKey, "GOSUMDB=" + testSumDBVerifierKey,
"GONOPROXY=",
"GONOSUMDB=",
tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"), tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"),
"devnull=" + os.DevNull, "devnull=" + os.DevNull,
"goversion=" + goVersion(ts), "goversion=" + goVersion(ts),
......
env GO111MODULE=on
env sumdb=$GOSUMDB
env proxy=$GOPROXY
env GOPROXY GONOPROXY GOSUMDB GONOSUMDB
env dbname=localhost.localdev/sumdb
# disagree with sumdb fails
cp go.mod.orig go.mod
env GOSUMDB=$sumdb' '$proxy/sumdb-wrong
! go get rsc.io/quote
stderr 'SECURITY ERROR'
# but GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text
env GONOSUMDB='*/quote,*/*mple*,golang.org/x'
go get rsc.io/quote
# and GONOPROXY bypasses proxy
[!net] skip
env GONOPROXY='*/fortune'
! go get rsc.io/fortune # does not exist in real world, only on test proxy
stderr 'git ls-remote'
env GOSUMDB=
env GONOPROXY='*/x'
go get golang.org/x/text
go list -m all
! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy
-- go.mod.orig --
module m
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment