mirror of https://github.com/golang/go.git
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: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
ee59c06acb
commit
d021dd6a3f
|
|
@ -111,6 +111,8 @@ func (ts *testScript) setup() {
|
|||
"GOPROXY=" + proxyURL,
|
||||
"GOROOT=" + testGOROOT,
|
||||
"GOSUMDB=" + testSumDBVerifierKey,
|
||||
"GONOPROXY=",
|
||||
"GONOSUMDB=",
|
||||
tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"),
|
||||
"devnull=" + os.DevNull,
|
||||
"goversion=" + goVersion(ts),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
Loading…
Reference in New Issue