aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_require_exclude.txt
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2020-09-11 14:23:34 -0400
committerRob Findley <rfindley@google.com>2020-09-11 14:23:34 -0400
commitf8b1c17aced24a1618c6984794be9770c5d260be (patch)
tree45af8d39b5c3d9f43d439ebec0a2ba42b49efe70 /src/cmd/go/testdata/script/mod_require_exclude.txt
parente5d91ab096a9ff9673311f1a7f3f860a7f9c2062 (diff)
parent07c1788357cfe6a4ee5f6f6a54d4fe9f579fa844 (diff)
downloadgo-f8b1c17aced24a1618c6984794be9770c5d260be.tar.gz
go-f8b1c17aced24a1618c6984794be9770c5d260be.zip
[dev.types] all: merge master into dev.typesdev.types
Change-Id: Ia6964cb4e09153c15cc9c5b441373d1b3cb8f757
Diffstat (limited to 'src/cmd/go/testdata/script/mod_require_exclude.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_require_exclude.txt62
1 files changed, 55 insertions, 7 deletions
diff --git a/src/cmd/go/testdata/script/mod_require_exclude.txt b/src/cmd/go/testdata/script/mod_require_exclude.txt
index 60f7e3fa91..9156d4ce5d 100644
--- a/src/cmd/go/testdata/script/mod_require_exclude.txt
+++ b/src/cmd/go/testdata/script/mod_require_exclude.txt
@@ -1,16 +1,51 @@
# build with no newer version to satisfy exclude
env GO111MODULE=on
-! go list -m all
-stderr 'no newer version available'
+cp go.mod go.mod.orig
+
+# With the selected version excluded, commands that query that version without
+# updating go.mod should fail.
+
+! go list -mod=readonly -m all
+stderr '^go: ignoring requirement on excluded version rsc.io/sampler v1\.99\.99$'
+stderr '^go: updates to go.mod needed, disabled by -mod=readonly$'
+! stdout '^rsc.io/sampler v1.99.99'
+cmp go.mod go.mod.orig
+
+! go list -mod=vendor -m rsc.io/sampler
+stderr '^go: ignoring requirement on excluded version rsc.io/sampler v1\.99\.99$'
+stderr '^go list -m: module rsc.io/sampler: can''t resolve module using the vendor directory\n\t\(Use -mod=mod or -mod=readonly to bypass\.\)$'
+! stdout '^rsc.io/sampler v1.99.99'
+cmp go.mod go.mod.orig
+
+# With the selected version excluded, commands that load only modules should
+# drop the excluded module.
+
+go list -m -mod=mod all
+stderr '^go: dropping requirement on excluded version rsc.io/sampler v1\.99\.99$'
+stdout '^x$'
+! stdout '^rsc.io/sampler'
+cmp go.mod go.moddrop
+
+# With the latest version excluded, 'go list' should resolve needed packages
+# from the next-highest version.
+
+cp go.mod.orig go.mod
+go list -mod=mod -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
+stderr '^go: dropping requirement on excluded version rsc.io/sampler v1\.99\.99$'
+stdout '^x $'
+! stdout '^rsc.io/sampler v1.99.99'
+stdout '^rsc.io/sampler v1.3.0'
# build with newer version available
cp go.mod2 go.mod
-go list -m all
+go list -mod=mod -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
+stderr '^go: dropping requirement on excluded version rsc.io/quote v1\.5\.1$'
stdout 'rsc.io/quote v1.5.2'
# build with excluded newer version
cp go.mod3 go.mod
-go list -m all
+go list -mod=mod -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
+! stderr '^go: dropping requirement'
stdout 'rsc.io/quote v1.5.1'
-- x.go --
@@ -19,15 +54,28 @@ import _ "rsc.io/quote"
-- go.mod --
module x
-exclude rsc.io/sampler latest
-require rsc.io/sampler latest
+go 1.13
+
+exclude rsc.io/sampler v1.99.99
+require rsc.io/sampler v1.99.99
+-- go.moddrop --
+module x
+
+go 1.13
+
+exclude rsc.io/sampler v1.99.99
-- go.mod2 --
module x
+
+go 1.13
+
exclude rsc.io/quote v1.5.1
require rsc.io/quote v1.5.1
-
-- go.mod3 --
module x
+
+go 1.13
+
exclude rsc.io/quote v1.5.2
require rsc.io/quote v1.5.1