]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: reproduce issue #44497 in TestScript/mod_edit
authorBryan C. Mills <bcmills@google.com>
Mon, 22 Feb 2021 20:04:25 +0000 (15:04 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 23 Feb 2021 21:18:30 +0000 (21:18 +0000)
For #44497

Change-Id: Ie5285b9c526506b6b1280a590a5dcbee4074f57b
Reviewed-on: https://go-review.googlesource.com/c/go/+/295149
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/testdata/script/mod_edit.txt

index d7e681e831397b56160bd2aab4f668712abe400f..02d2d40bbb49b983bb366a87b7896028e0ad9b64 100644 (file)
@@ -26,6 +26,25 @@ cmpenv go.mod $WORK/go.mod.edit2
 stderr '^go mod: -exclude=example.com/m@bad: version "bad" invalid: must be of the form v1.2.3$'
 ! go mod edit -retract=bad
 stderr '^go mod: -retract=bad: version "bad" invalid: must be of the form v1.2.3$'
+cmpenv go.mod $WORK/go.mod.edit2
+
+cp go.mod go.mod.beforebugs
+
+# BUG(#44497): -exclude accepts a mismatched major version without +incompatible, but should not.
+go mod edit -exclude=example.com/m@v2.0.0
+! go mod edit -json
+stderr '^go: errors parsing go.mod:\n.*[/\\]go.mod:16: exclude example\.com/m: version "v2\.0\.0" invalid: should be v0 or v1, not v2$'
+cp go.mod.beforebugs go.mod
+
+# BUG(#44497): -exclude accepts a v1 version for a v2 module, but should not.
+go mod edit -exclude=example.com/m/v2@v1.0.0
+! go mod edit -json
+stderr '^go: errors parsing go.mod:\n.*[/\\]go.mod:16: exclude example\.com/m/v2: version "v1\.0\.0" invalid: should be v2, not v1$'
+cp go.mod.beforebugs go.mod
+
+# BUG(#44497): -exclude rejects a +incompatible version for an unversioned
+# module path, but should not.
+! go mod edit -exclude=example.com/m@v2.0.0+incompatible
 
 # go mod edit -json
 go mod edit -json