]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: restore TestLegacyMod as a script test
authorBryan C. Mills <bcmills@google.com>
Thu, 14 Jul 2022 20:35:37 +0000 (16:35 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 16 Aug 2022 16:15:13 +0000 (16:15 +0000)
This test was apparently mistakenly removed without a replacement in
CL 213223, but its testdata was left in the tree. This change removes
the orphaned testdata subdirectory, and restores the test that
previously used that data as a self-contained script.

For #27494.

Change-Id: Ice81895a44c558aaab198b8ef7ec046d92f5d58f
Reviewed-on: https://go-review.googlesource.com/c/go/+/417658
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/go/testdata/modlegacy/src/new/go.mod [deleted file]
src/cmd/go/testdata/modlegacy/src/new/new.go [deleted file]
src/cmd/go/testdata/modlegacy/src/new/p1/p1.go [deleted file]
src/cmd/go/testdata/modlegacy/src/new/p2/p2.go [deleted file]
src/cmd/go/testdata/modlegacy/src/new/sub/go.mod [deleted file]
src/cmd/go/testdata/modlegacy/src/new/sub/inner/go.mod [deleted file]
src/cmd/go/testdata/modlegacy/src/new/sub/inner/x/x.go [deleted file]
src/cmd/go/testdata/modlegacy/src/new/sub/x/v1/y/y.go [deleted file]
src/cmd/go/testdata/modlegacy/src/old/p1/p1.go [deleted file]
src/cmd/go/testdata/modlegacy/src/old/p2/p2.go [deleted file]
src/cmd/go/testdata/script/list_legacy_mod.txt [new file with mode: 0644]

diff --git a/src/cmd/go/testdata/modlegacy/src/new/go.mod b/src/cmd/go/testdata/modlegacy/src/new/go.mod
deleted file mode 100644 (file)
index d0dd46d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module "new/v2"
diff --git a/src/cmd/go/testdata/modlegacy/src/new/new.go b/src/cmd/go/testdata/modlegacy/src/new/new.go
deleted file mode 100644 (file)
index e99c47a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-package new
-
-import _ "new/v2/p2"
diff --git a/src/cmd/go/testdata/modlegacy/src/new/p1/p1.go b/src/cmd/go/testdata/modlegacy/src/new/p1/p1.go
deleted file mode 100644 (file)
index 4539f40..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package p1
-
-import _ "old/p2"
-import _ "new/v2"
-import _ "new/v2/p2"
-import _ "new/sub/v2/x/v1/y" // v2 is module, v1 is directory in module
-import _ "new/sub/inner/x"   // new/sub/inner/go.mod overrides new/sub/go.mod
diff --git a/src/cmd/go/testdata/modlegacy/src/new/p2/p2.go b/src/cmd/go/testdata/modlegacy/src/new/p2/p2.go
deleted file mode 100644 (file)
index 9b9052f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-package p2
diff --git a/src/cmd/go/testdata/modlegacy/src/new/sub/go.mod b/src/cmd/go/testdata/modlegacy/src/new/sub/go.mod
deleted file mode 100644 (file)
index 484d20c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module new/sub/v2
diff --git a/src/cmd/go/testdata/modlegacy/src/new/sub/inner/go.mod b/src/cmd/go/testdata/modlegacy/src/new/sub/inner/go.mod
deleted file mode 100644 (file)
index ba39345..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module new/sub/inner
diff --git a/src/cmd/go/testdata/modlegacy/src/new/sub/inner/x/x.go b/src/cmd/go/testdata/modlegacy/src/new/sub/inner/x/x.go
deleted file mode 100644 (file)
index 823aafd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-package x
diff --git a/src/cmd/go/testdata/modlegacy/src/new/sub/x/v1/y/y.go b/src/cmd/go/testdata/modlegacy/src/new/sub/x/v1/y/y.go
deleted file mode 100644 (file)
index 789ca71..0000000
+++ /dev/null
@@ -1 +0,0 @@
-package y
diff --git a/src/cmd/go/testdata/modlegacy/src/old/p1/p1.go b/src/cmd/go/testdata/modlegacy/src/old/p1/p1.go
deleted file mode 100644 (file)
index 9052748..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package p1
-
-import _ "old/p2"
-import _ "new/p1"
-import _ "new"
diff --git a/src/cmd/go/testdata/modlegacy/src/old/p2/p2.go b/src/cmd/go/testdata/modlegacy/src/old/p2/p2.go
deleted file mode 100644 (file)
index 9b9052f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-package p2
diff --git a/src/cmd/go/testdata/script/list_legacy_mod.txt b/src/cmd/go/testdata/script/list_legacy_mod.txt
new file mode 100644 (file)
index 0000000..ab901d7
--- /dev/null
@@ -0,0 +1,48 @@
+# In GOPATH mode, module legacy support does path rewriting very similar to vendoring.
+
+env GO111MODULE=off
+
+go list -f '{{range .Imports}}{{.}}{{"\n"}}{{end}}' old/p1
+stdout ^new/p1$
+
+go list -f '{{range .Imports}}{{.}}{{"\n"}}{{end}}' new/p1
+stdout ^new/p2$           # not new/v2/p2
+! stdout ^new/v2
+stdout ^new/sub/x/v1/y$   # not new/sub/v2/x/v1/y
+! stdout ^new/sub/v2
+stdout ^new/sub/inner/x # not new/sub/v2/inner/x
+
+go build old/p1 new/p1
+
+-- new/go.mod --
+module "new/v2"
+-- new/new.go --
+package new
+
+import _ "new/v2/p2"
+-- new/p1/p1.go --
+package p1
+
+import _ "old/p2"
+import _ "new/v2"
+import _ "new/v2/p2"
+import _ "new/sub/v2/x/v1/y" // v2 is module, v1 is directory in module
+import _ "new/sub/inner/x"   // new/sub/inner/go.mod overrides new/sub/go.mod
+-- new/p2/p2.go --
+package p2
+-- new/sub/go.mod --
+module new/sub/v2
+-- new/sub/inner/go.mod --
+module new/sub/inner
+-- new/sub/inner/x/x.go --
+package x
+-- new/sub/x/v1/y/y.go --
+package y
+-- old/p1/p1.go --
+package p1
+
+import _ "old/p2"
+import _ "new/p1"
+import _ "new"
+-- old/p2/p2.go --
+package p2