Skip to content

Commit

Permalink
cmd: upgrade golang.org/x/mod to fix go.mod parser
Browse files Browse the repository at this point in the history
modfile.Parse passed an empty string to the VersionFixer for the
module path. This caused errors for v2+ versions.

Fixes #44494

Change-Id: I13b86b6ecf6815c4bc9a96ec0668284c9228c205
Reviewed-on: https://go-review.googlesource.com/c/go/+/296131
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
  • Loading branch information
Jay Conrod committed Feb 25, 2021
1 parent 3137da8 commit bcac57f
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/cmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/mod v0.4.2-0.20210223202949-66f6d92cabd5
golang.org/x/mod v0.4.2-0.20210225160341-66bf157bf5bc
golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e // indirect
golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f
)
4 changes: 2 additions & 2 deletions src/cmd/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2-0.20210223202949-66f6d92cabd5 h1:ETedWdSKv0zHgSxvhXszxH25fCWwA6olYCPu9ehlVKs=
golang.org/x/mod v0.4.2-0.20210223202949-66f6d92cabd5/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2-0.20210225160341-66bf157bf5bc h1:xQukuh0OD2SNSUK1CCBFATgHYx5ye75S/bAWEU/PT0E=
golang.org/x/mod v0.4.2-0.20210225160341-66bf157bf5bc/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
Expand Down
24 changes: 24 additions & 0 deletions src/cmd/go/testdata/script/mod_retract_fix_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# retract must not be used without a module directive.
! go list -m all
stderr 'go.mod:3: no module directive found, so retract cannot be used$'

# Commands that update go.mod should fix non-canonical versions in
# retract directives.
# Verifies #44494.
go mod edit -module=rsc.io/quote/v2
! go list -m all
stderr '^go: updates to go.mod needed; to update it:\n\tgo mod tidy$'
go mod tidy
go list -m all
cmp go.mod go.mod.want

-- go.mod --
go 1.16

retract latest
-- go.mod.want --
go 1.16

retract v2.0.1

module rsc.io/quote/v2
102 changes: 81 additions & 21 deletions src/cmd/vendor/golang.org/x/mod/modfile/rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cmd/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ golang.org/x/arch/x86/x86asm
golang.org/x/crypto/ed25519
golang.org/x/crypto/ed25519/internal/edwards25519
golang.org/x/crypto/ssh/terminal
# golang.org/x/mod v0.4.2-0.20210223202949-66f6d92cabd5
# golang.org/x/mod v0.4.2-0.20210225160341-66bf157bf5bc
## explicit
golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile
Expand Down

0 comments on commit bcac57f

Please sign in to comment.