cmd/go/testdata/script: don't use network in mod_gonoproxy test

Create fake modules in the proxy that we intend to not fetch.

For #80243

Change-Id: Iad6a205039fa2cf512073d5f4870ce776a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/795907
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Michael Matloob 2026-06-30 13:18:27 -04:00 committed by Michael Matloob
parent 0f091acc1a
commit 44db00e9c1
3 changed files with 28 additions and 8 deletions

View File

@ -0,0 +1,8 @@
This is a module that could exist in a vcstest git repo, but that doesn't.
-- .mod --
module vcs-test.golang.org/git/proxyonly.git
-- .info --
{"Version":"v0.0.1"}
-- proxyonly.go --
package proxyonly

View File

@ -0,0 +1,9 @@
There's a tagtests git repo, but add a proxy version, so we
can test that it's not available in mod_gonoproxy.
-- .mod --
module vcs-test.golang.org/git/tagtests.git
-- .info --
{"Version":"v0.1.0"}
-- tagtests.go --
package tagtests

View File

@ -35,21 +35,24 @@ env GOPROXY=off
! go get golang.org/x/text
stderr '^go: golang.org/x/text: module lookup disabled by GOPROXY=off$'
[short] skip 'the rest of the test uses git'
# GONOPROXY bypasses proxy
[!net:rsc.io] skip
[!git] skip
env GOPROXY=$proxy
env GOSUMDB=$sumdb
env GOPRIVATE=none
env GONOPROXY='*/fortune'
! go get rsc.io/fortune # does not exist in real world, only on test proxy
env GONOPROXY='*/git/proxyonly.git'
! go get vcs-test.golang.org/git/proxyonly.git # does not exist in vcstest, only on test proxy
stderr 'git ls-remote'
[!net:golang.org] skip
env GOSUMDB=
env GOSUMDB=off
env GONOPROXY=
env GOPRIVATE='*/x'
go get golang.org/x/text
env GOPRIVATE='*/git/tagtests.git'
go get vcs-test.golang.org/git/tagtests.git
go list -m all
! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy
stdout '^vcs-test.golang.org/git/tagtests.git v0.2.2$'
! stdout 'tagtests.git v0.1.0' # should not have the version from the proxy
-- go.mod.orig --
module m