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

Closed
somethingwikid opened this issue Sep 21, 2020 · 7 comments
Closed

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

somethingwikid opened this issue Sep 21, 2020 · 7 comments
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@somethingwikid
Copy link

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
Contributor

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
Contributor

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 modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 22, 2020
@bcmills bcmills added this to the Unplanned milestone Sep 22, 2020
@somethingwikid
Copy link
Author

somethingwikid commented Sep 22, 2020 via email

@cannibal-kush
Copy link

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.

@jazzjackrabb1t
Copy link

Any progress on this issue? It still same in version 1.18.

@bcmills
Copy link
Contributor

bcmills commented Jun 23, 2022

This is working as designed. Design changes to the set of allowed module paths should go through the Go proposal process.

@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2022
@evanbuschor
Copy link

I also have this issue. The docs recommend using the location where your package can be referenced as the name for your package but don't allow all urls to be used.

We are using Azure devops and there is no chance of changing the project names that make up the urls to our repos.

@golang golang locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants