Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: '%' character in module path rejected in 'go mod init' #41540

Open
lonnieherring opened this issue Sep 21, 2020 · 4 comments
Open

cmd/go: '%' character in module path rejected in 'go mod init' #41540

lonnieherring opened this issue Sep 21, 2020 · 4 comments

Comments

@lonnieherring
Copy link

@lonnieherring lonnieherring commented Sep 21, 2020

The restrictions seem to be too tight for git mod can we loosen them. I have seen other issues posted with other characters but not the % for instance ".:;/.." etc
The path to my repo has a space in it.

$ go version
go version go1.15.2 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Ubuntu 18.04

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/.../.cache/go-build"
GOENV="/home/.../.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/.../go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/../go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build831607011=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go mod init dev.azure.com/some%20folder

What did you expect to see?

create the go.mod file

What did you see instead?

go: malformed import path "dev.azure.com/some%20folder": invalid char '%'

@bcmills bcmills changed the title go mod init escaped url invalid char '%' cmd/go: '%' character in module path rejected in 'go mod init' Sep 22, 2020
@bcmills
Copy link
Member

@bcmills bcmills commented Sep 22, 2020

The accepted syntax for module paths is documented here.

The % character seems specifically important not to allow, because it would be ambiguous: would %20 mean a literal space character, or the string %20? Simpler to avoid ambiguity (and avoid the possibility of path-escaping bugs in proxy servers).

@bcmills
Copy link
Member

@bcmills bcmills commented Sep 22, 2020

This is working as designed. Is there some reason that paths of this form cannot be avoided for your use-case?

(CC @jayconrod @matloob)

@bcmills bcmills added this to the Unplanned milestone Sep 22, 2020
@lonnieherring
Copy link
Author

@lonnieherring lonnieherring commented Sep 22, 2020

@cannibal-kush
Copy link

@cannibal-kush cannibal-kush commented Sep 30, 2020

I have the exact same issue, no idea what to name my module now. Renaming the VCS' path is not trivial.

I'd say there's no ambiguity, a %20 is a %20, at least for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.