]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: test that 'go mod tidy' retains upgraded indirect dependencies
authorBryan C. Mills <bcmills@google.com>
Fri, 5 Mar 2021 16:30:23 +0000 (11:30 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 16 Mar 2021 13:39:46 +0000 (13:39 +0000)
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>
src/cmd/go/testdata/script/mod_tidy_indirect.txt [new file with mode: 0644]

diff --git a/src/cmd/go/testdata/script/mod_tidy_indirect.txt b/src/cmd/go/testdata/script/mod_tidy_indirect.txt
new file mode 100644 (file)
index 0000000..1f092b2
--- /dev/null
@@ -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