1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:40:05 -07:00

cmd/go: make TestScript/mod_get_patchmod self-contained

I find it pretty difficult to reason about test-dependency modules
when they aren't in the same file as the rest of the test.

Now that 'go get' supports replacements (CL 258220 and CL 266018),
we can localize tests that need 'go get' but don't specifically depend
on module proxy semantics.

For #36460
For #37438

Change-Id: Ib37a6c170f251435399dfc23e60d96681a81eadc
Reviewed-on: https://go-review.googlesource.com/c/go/+/266369
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Bryan C. Mills 2020-10-29 16:06:19 -04:00
parent 36d412f754
commit 8494a6243e
4 changed files with 15 additions and 47 deletions

View File

@ -1,16 +0,0 @@
Written by hand.
Test module with a root package added in v0.1.0 and removed in v0.2.0.
-- .mod --
module example.net/pkgremoved
go 1.16
-- .info --
{"Version": "v0.1.0"}
-- go.mod --
module example.net/pkgremoved
go 1.16
-- pkgremoved.go --
// Package pkgremoved exists in v0.1.0.
package pkgremoved

View File

@ -1,15 +0,0 @@
Written by hand.
Test module with a root package added in v0.1.0 and removed in v0.2.0.
-- .mod --
module example.net/pkgremoved
go 1.16
-- .info --
{"Version": "v0.2.0"}
-- go.mod --
module example.net/pkgremoved
go 1.16
-- README.txt --
Package pkgremove was removed in v0.2.0.

View File

@ -1,15 +0,0 @@
Written by hand.
Test module with a root package added in v0.1.0 and removed in v0.2.0.
-- .mod --
module example.net/pkgremoved
go 1.16
-- .info --
{"Version": "v0.2.1"}
-- go.mod --
module example.net/pkgremoved
go 1.16
-- README.txt --
Package pkgremove was removed in v0.2.0.

View File

@ -17,7 +17,7 @@ stdout '^example.net/pkgremoved'
! go get -d example.net/pkgremoved@patch example.net/other@v0.1.0
stderr '^go get example.net/pkgremoved@patch: module example.net/pkgremoved@latest found \(v0.2.1\), but does not contain package example.net/pkgremoved$'
stderr '^go get example.net/pkgremoved@patch: module example.net/pkgremoved@latest found \(v0.2.1, replaced by ./pr2\), but does not contain package example.net/pkgremoved$'
-- go.mod --
@ -27,6 +27,10 @@ go 1.16
replace (
example.net/other v0.1.0 => ./other
example.net/pkgremoved v0.1.0 => ./pr1
example.net/pkgremoved v0.1.1 => ./pr1
example.net/pkgremoved v0.2.0 => ./pr2
example.net/pkgremoved v0.2.1 => ./pr2
)
-- other/go.mod --
module example.net/other
@ -36,3 +40,13 @@ go 1.16
require example.net/pkgremoved v0.2.0
-- other/other.go --
package other
-- pr1/go.mod --
module example.net/pkgremoved
go 1.16
-- pr1/pkgremoved.go --
package pkgremoved
-- pr2/go.mod --
module example.net/pkgremoved
-- pr2/README.txt --
Package pkgremoved was removed in v0.2.0.