Skip to content

Commit e125ccd

Browse files
author
Jay Conrod
committed
cmd/go: in 'go mod edit', validate versions given to -retract and -exclude
Fixes #43280 Change-Id: Icb6c6807fe32a89202a2709d4a1c8d8af967628f Reviewed-on: https://go-review.googlesource.com/c/go/+/283853 Trust: Jay Conrod <[email protected]> Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent eb33002 commit e125ccd

File tree

5 files changed

+40
-4
lines changed

5 files changed

+40
-4
lines changed

src/cmd/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2
77
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
88
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
9-
golang.org/x/mod v0.4.0
9+
golang.org/x/mod v0.4.1
1010
golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
1111
golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff
1212
)

src/cmd/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
1414
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
1515
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
1616
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
17-
golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
18-
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
17+
golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
18+
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
1919
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
2020
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
2121
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ cmpenv go.mod $WORK/go.mod.edit1
2121
go mod edit -droprequire=x.1 [email protected] [email protected] [email protected] -dropretract=v1.0.0 -dropretract=[v1.1.0,v1.2.0]
2222
cmpenv go.mod $WORK/go.mod.edit2
2323

24+
# -exclude and -retract reject invalid versions.
25+
! go mod edit -exclude=example.com/m@bad
26+
stderr '^go mod: -exclude=example.com/m@bad: version "bad" invalid: must be of the form v1.2.3$'
27+
! go mod edit -retract=bad
28+
stderr '^go mod: -retract=bad: version "bad" invalid: must be of the form v1.2.3$'
29+
2430
# go mod edit -json
2531
go mod edit -json
2632
cmpenv stdout $WORK/go.mod.json

src/cmd/vendor/golang.org/x/mod/modfile/rule.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ golang.org/x/arch/x86/x86asm
2828
golang.org/x/crypto/ed25519
2929
golang.org/x/crypto/ed25519/internal/edwards25519
3030
golang.org/x/crypto/ssh/terminal
31-
# golang.org/x/mod v0.4.0
31+
# golang.org/x/mod v0.4.1
3232
## explicit
3333
golang.org/x/mod/internal/lazyregexp
3434
golang.org/x/mod/modfile

0 commit comments

Comments
 (0)