cmd/go/testdata/script: remove net from mod_download_private_vcs

Use the vsstest auth handler to create a 401 from a fake http git repo.

For #80243

Change-Id: Ia9faba99e37951e9ef949707bf52b6456a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/795906
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
diff --git a/src/cmd/go/testdata/script/mod_download_private_vcs.txt b/src/cmd/go/testdata/script/mod_download_private_vcs.txt
index 96d7ae7..0e7f555 100644
--- a/src/cmd/go/testdata/script/mod_download_private_vcs.txt
+++ b/src/cmd/go/testdata/script/mod_download_private_vcs.txt
@@ -1,7 +1,5 @@
-env GO111MODULE=on
-
 # Testing stderr for git ls-remote; turn off proxy.
-[!net:github.com] skip
+[short] skip
 [!git] skip
 env GOPROXY=direct
 
@@ -13,18 +11,18 @@
 exec git config --global --show-origin user.name
 stdout 'Go Gopher'
 
-! go mod download github.com/golang/nonexist@latest
+! go mod download vcs-test.golang.org/auth/githttp401.git@latest
 stderr 'Confirm the import path was entered correctly.'
 stderr 'If this is a private repository, see https://go.dev/doc/faq#git_https for additional information.'
 ! stdout .
 
 # Fetching a nonexistent commit should return an "unknown revision"
 # error message.
-! go mod download github.com/golang/term@86186f3aba07ed0212cfb944f3398997d2d07c6b
-stderr '^go: github.com/golang/term@86186f3aba07ed0212cfb944f3398997d2d07c6b: invalid version: unknown revision 86186f3aba07ed0212cfb944f3398997d2d07c6b$'
+! go mod download vcs-test.golang.org/git/mainonly.git@86186f3aba07ed0212cfb944f3398997d2d07c6b
+stderr '^go: vcs-test.golang.org/git/mainonly.git@86186f3aba07ed0212cfb944f3398997d2d07c6b: invalid version: unknown revision 86186f3aba07ed0212cfb944f3398997d2d07c6b$'
 ! stdout .
 
-! go mod download github.com/golang/nonexist@master
+! go mod download vcs-test.golang.org/auth/githttp401.git@master
 stderr '^Confirm the import path was entered correctly.$'
 stderr '^If this is a private repository, see https://go.dev/doc/faq#git_https for additional information.$'
 ! stderr 'unknown revision'
@@ -35,9 +33,9 @@
 # Test that Git clone errors will be shown to the user instead of a generic
 # "unknown revision" error. To do this we want to force git ls-remote to return
 # an error we don't already have special handling for. See golang/go#42751.
-exec git config --global url.git@github.com.insteadOf https://github.com/
+exec git config --global url.git@vcs-test.golang.org:.insteadOf http://$TESTGO_VCSTEST_HOST/
 env GIT_SSH_COMMAND=false
-! go install github.com/golang/nonexist@master
+! go install vcs-test.golang.org/auth/githttp401.git@master
 stderr 'fatal: Could not read from remote repository.'
 ! stderr 'unknown revision'
 ! stdout .
diff --git a/src/cmd/go/testdata/vcstest/auth/githttp401.txt b/src/cmd/go/testdata/vcstest/auth/githttp401.txt
new file mode 100644
index 0000000..1b7cc44
--- /dev/null
+++ b/src/cmd/go/testdata/vcstest/auth/githttp401.txt
@@ -0,0 +1,10 @@
+handle auth
+
+-- .access --
+{
+	"Username": "aladdin",
+	"Password": "opensesame",
+	"StatusCode": 401,
+	"Message": "ACCESS DENIED, buddy"
+}
+-- info/refs --