summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt')
-rw-r--r--libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt31
1 files changed, 29 insertions, 2 deletions
diff --git a/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt b/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt
index 6bc1c77ed3d..0c1c1d22f5b 100644
--- a/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt
+++ b/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt
@@ -1,7 +1,7 @@
env GO111MODULE=on
# Before vendoring, we expect to see the original directory.
-go list -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3
+go list -f '{{with .Module}}{{.Version}}{{end}} {{.Dir}}' rsc.io/quote/v3
stdout 'v3.0.0'
stdout '.*[/\\]not-rsc.io[/\\]quote[/\\]v3'
@@ -15,12 +15,22 @@ go mod vendor
# without attempting to look up the non-replaced version.
cmp vendor/rsc.io/quote/v3/quote.go local/not-rsc.io/quote/v3/quote.go
-go list -mod=vendor -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3
+go list -mod=vendor -f '{{with .Module}}{{.Version}}{{end}} {{.Dir}}' rsc.io/quote/v3
stdout 'v3.0.0'
stdout '.*[/\\]vendor[/\\]rsc.io[/\\]quote[/\\]v3'
! stderr 'finding'
! stderr 'lookup disabled'
+# 'go list' should provide the original replacement directory as the module's
+# replacement path.
+go list -mod=vendor -f '{{with .Module}}{{with .Replace}}{{.Path}}{{end}}{{end}}' rsc.io/quote/v3
+stdout '.*[/\\]not-rsc.io[/\\]quote[/\\]v3'
+
+# The same module can't be used as two different paths.
+cd multiple-paths
+! go mod vendor
+stderr 'rsc.io/quote/v3@v3.0.0 used for two different module paths \(not-rsc.io/quote/v3 and rsc.io/quote/v3\)'
+
-- go.mod --
module example.com/replace
@@ -37,3 +47,20 @@ module not-rsc.io/quote/v3
-- local/not-rsc.io/quote/v3/quote.go --
package quote
+
+-- multiple-paths/main.go --
+package main
+import (
+ "fmt"
+ "rsc.io/quote/v3"
+)
+func main() {
+ fmt.Println(quote.GoV3())
+}
+-- multiple-paths/go.mod --
+module quoter
+require (
+ rsc.io/quote/v3 v3.0.0
+ not-rsc.io/quote/v3 v3.0.0
+)
+replace not-rsc.io/quote/v3 => rsc.io/quote/v3 v3.0.0