Skip to content

Commit fa40c02

Browse files
author
Bryan C. Mills
committed
cmd/go: reproduce issue #44497 in TestScript/mod_edit
For #44497 Change-Id: Ie5285b9c526506b6b1280a590a5dcbee4074f57b Reviewed-on: https://go-review.googlesource.com/c/go/+/295149 Trust: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent a4dac8b commit fa40c02

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/cmd/go/testdata/script/mod_edit.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ cmpenv go.mod $WORK/go.mod.edit2
2626
stderr '^go mod: -exclude=example.com/m@bad: version "bad" invalid: must be of the form v1.2.3$'
2727
! go mod edit -retract=bad
2828
stderr '^go mod: -retract=bad: version "bad" invalid: must be of the form v1.2.3$'
29+
cmpenv go.mod $WORK/go.mod.edit2
30+
31+
cp go.mod go.mod.beforebugs
32+
33+
# BUG(#44497): -exclude accepts a mismatched major version without +incompatible, but should not.
34+
go mod edit -exclude=example.com/[email protected]
35+
! go mod edit -json
36+
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$'
37+
cp go.mod.beforebugs go.mod
38+
39+
# BUG(#44497): -exclude accepts a v1 version for a v2 module, but should not.
40+
go mod edit -exclude=example.com/m/[email protected]
41+
! go mod edit -json
42+
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$'
43+
cp go.mod.beforebugs go.mod
44+
45+
# BUG(#44497): -exclude rejects a +incompatible version for an unversioned
46+
# module path, but should not.
47+
! go mod edit -exclude=example.com/[email protected]+incompatible
2948

3049
# go mod edit -json
3150
go mod edit -json

0 commit comments

Comments
 (0)