1
0
mirror of https://github.com/golang/go synced 2024-11-19 05:24:42 -07:00

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 <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>
This commit is contained in:
Bryan C. Mills 2021-02-22 15:04:25 -05:00
parent a4dac8bd22
commit fa40c0232c

View 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