1 # https://golang.org/issue/44776
2 # The '+' character should be disallowed in module paths, but allowed in package
3 # paths within valid modules.
4
5 # 'go list' accepts package paths with pluses.
6 cp go.mod.orig go.mod
7 go get example.net/cmd
8 go list example.net/cmd/x++
9
10 # 'go list -m' rejects module paths with pluses.
11 ! go list -versions -m 'example.net/bad++'
12 stderr '^go: malformed module path "example.net/bad\+\+": invalid char ''\+''$'
13
14 # 'go get' accepts package paths with pluses.
15 cp go.mod.orig go.mod
16 go get example.net/cmd/x++
17 go list -m example.net/cmd
18 stdout '^example.net/cmd v0.0.0-00010101000000-000000000000 => ./cmd$'
19
20 -- go.mod.orig --
21 module example.com/m
22
23 go 1.16
24
25 replace (
26 example.net/cmd => ./cmd
27 )
28
29 -- cmd/go.mod --
30 module example.net/cmd
31
32 go 1.16
33 -- cmd/x++/main.go --
34 package main
35
36 func main() {}
37
View as plain text