1
0
mirror of https://github.com/golang/go synced 2024-09-24 03:10:16 -06:00

cmd/go: test that 'go mod tidy' retains upgraded indirect dependencies

For #36460

Change-Id: I63596e1c95d0c702073cdb016579598d79cc95ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/300158
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Bryan C. Mills 2021-03-05 11:30:23 -05:00
parent 120b9eb1c3
commit 0089f8b2f5

View File

@ -0,0 +1,67 @@
cp go.mod go.mod.orig
go mod tidy
cmp go.mod go.mod.orig
-- go.mod --
module example.com/tidy
go 1.16
require (
example.net/incomplete v0.1.0
example.net/indirect v0.2.0 // indirect
example.net/toolow v0.1.0
)
replace (
example.net/incomplete v0.1.0 => ./incomplete
example.net/indirect v0.1.0 => ./indirect.1
example.net/indirect v0.2.0 => ./indirect.2
example.net/toolow v0.1.0 => ./toolow
)
-- tidy.go --
package tidy
import (
_ "example.net/incomplete"
_ "example.net/toolow"
)
-- incomplete/go.mod --
module example.net/incomplete
go 1.16
// This module omits a needed requirement on example.net/indirect.
-- incomplete/incomplete.go --
package incomplete
import _ "example.net/indirect/newpkg"
-- toolow/go.mod --
module example.net/toolow
go 1.16
require example.net/indirect v0.1.0
-- toolow/toolow.go --
package toolow
import _ "example.net/indirect/oldpkg"
-- indirect.1/go.mod --
module example.net/indirect
go 1.16
-- indirect.1/oldpkg/oldpkg.go --
package oldpkg
-- indirect.2/go.mod --
module example.net/indirect
go 1.16
-- indirect.2/oldpkg/oldpkg.go --
package oldpkg
-- indirect.2/newpkg/newpkg.go --
package newpkg