Skip to content

Commit

Permalink
[release-branch.go1.16] cmd/go: allow '+' in package import paths in …
Browse files Browse the repository at this point in the history
…module mode

This change upgrades x/mod to pull in the fix from CL 300152.

Updates #44776.
Fixes #44885.

Change-Id: I273f41df2abfff76d91315b7f19fce851c8770d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/300176
Trust: Bryan C. Mills <[email protected]>
Run-TryBot: Bryan C. Mills <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
TryBot-Result: Go Bot <[email protected]>
(cherry picked from commit d33e219)
Reviewed-on: https://go-review.googlesource.com/c/go/+/300153
  • Loading branch information
Bryan C. Mills authored and dr2chase committed Mar 31, 2021
1 parent 1d967ab commit 2940614
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 12 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.20210302225053-d515b24adc21
golang.org/x/mod v0.4.2-0.20210325185522-dbbbf8a3c6ea
golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff
)
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.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2-0.20210302225053-d515b24adc21 h1:FnWKa8BJXkVQ+16E52jkfBOJPx2cG8y/6X376nOgSM4=
golang.org/x/mod v0.4.2-0.20210302225053-d515b24adc21/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2-0.20210325185522-dbbbf8a3c6ea h1:zAn46O7Vmm6KdLXx+635hPZSArrt/wNctv4Ab70Jw3k=
golang.org/x/mod v0.4.2-0.20210325185522-dbbbf8a3c6ea/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
32 changes: 32 additions & 0 deletions src/cmd/go/testdata/script/mod_invalid_path_plus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://golang.org/issue/44776
# The '+' character should be disallowed in module paths, but allowed in package
# paths within valid modules.

go get -d example.net/cmd
go list example.net/cmd/x++

! go list -versions -m 'example.net/bad++'
stderr '^go list -m: module example.net/bad\+\+: malformed module path "example.net/bad\+\+": invalid char ''\+''$'

# TODO(bcmills): 'go get -d example.net/cmd/x++' should also work, but currently
# it does not. This might be fixed by https://golang.org/cl/297891.
! go get -d example.net/cmd/x++
stderr '^go get: malformed module path "example.net/cmd/x\+\+": invalid char ''\+''$'

-- go.mod --
module example.com/m

go 1.16

replace (
example.net/cmd => ./cmd
)

-- cmd/go.mod --
module example.net/cmd

go 1.16
-- cmd/x++/main.go --
package main

func main() {}
38 changes: 30 additions & 8 deletions src/cmd/vendor/golang.org/x/mod/module/module.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.20210302225053-d515b24adc21
# golang.org/x/mod v0.4.2-0.20210325185522-dbbbf8a3c6ea
## explicit
golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile
Expand Down

0 comments on commit 2940614

Please sign in to comment.