From 3c656445f139d8b6def40aa7beffd5da9fceccdb Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 21 May 2021 16:33:42 -0400 Subject: [PATCH] cmd/go: in TestScript/mod_replace, download an explicit module path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As of CL 318629, 'go mod download' without arguments does not save checksums for module source code. Without a checksum, 'go list' will not report the location of the source code even if it is present, in order to prevent accidental access of mismatched code. Downloading an explicit module here also more clearly expresses the intent of the test (“download this module and see where it is”), and may be somewhat more efficient (since the test doesn't need source code for the other modules in the build list). Updates #45332 Change-Id: Ic589b22478e3ed140b95365bb6729101dd598ccc Reviewed-on: https://go-review.googlesource.com/c/go/+/321956 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills Reviewed-by: Dmitri Shuralyov TryBot-Result: Go Bot --- src/cmd/go/testdata/script/mod_replace.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/go/testdata/script/mod_replace.txt b/src/cmd/go/testdata/script/mod_replace.txt index dc9667f1d0..a0a367fb1d 100644 --- a/src/cmd/go/testdata/script/mod_replace.txt +++ b/src/cmd/go/testdata/script/mod_replace.txt @@ -48,7 +48,7 @@ stderr 'module rsc.io/quote/v3@upgrade found \(v3.0.0, replaced by ./local/rsc.i # The reported Dir and GoMod for a replaced module should be accurate. cp go.mod.orig go.mod go mod edit -replace=rsc.io/quote/v3=not-rsc.io/quote@v0.1.0-nomod -go mod download +go mod download rsc.io/quote/v3 go list -m -f '{{.Path}} {{.Version}} {{.Dir}} {{.GoMod}}{{with .Replace}} => {{.Path}} {{.Version}} {{.Dir}} {{.GoMod}}{{end}}' rsc.io/quote/v3 stdout '^rsc.io/quote/v3 v3.0.0 '$GOPATH'[/\\]pkg[/\\]mod[/\\]not-rsc.io[/\\]quote@v0.1.0-nomod '$GOPATH'[/\\]pkg[/\\]mod[/\\]cache[/\\]download[/\\]not-rsc.io[/\\]quote[/\\]@v[/\\]v0.1.0-nomod.mod => not-rsc.io/quote v0.1.0-nomod '$GOPATH'[/\\]pkg[/\\]mod[/\\]not-rsc.io[/\\]quote@v0.1.0-nomod '$GOPATH'[/\\]pkg[/\\]mod[/\\]cache[/\\]download[/\\]not-rsc.io[/\\]quote[/\\]@v[/\\]v0.1.0-nomod.mod$' -- 2.50.0