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: module-mode import path check is more restrictive than GOPATH mode #29101

Open
bcmills opened this issue Dec 4, 2018 · 2 comments

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Dec 4, 2018

As of #18660, go get in GOPATH mode allows any Unicode letter, but in module mode allows only ASCII letters in order to ensure that the path can be represented in the filesystem-agnostic “safe” encoding.

We should resolve that difference, ideally by defining a filesystem-safe encoding for all paths currently accepted in GOPATH mode.

(CC @rsc @dmitshur)

@dmitshur

This comment has been minimized.

Copy link
Member

@dmitshur dmitshur commented Dec 7, 2018

As of #18660, go get in GOPATH mode allows any Unicode letter

To be more precise, #18660 was about allowing Unicode letters within the "subdir" part of github.com import paths like "github.com/user/repo/subdir" (but not within "user" or "repo" parts).

To my knowledge, Unicode letters were allowed in vanity import paths since Go 1 or close to thereof. I tried Go 1.2.2 just now (the oldest release with binaries at https://golang.org/dl/), and it doesn't reject Unicode letters in a vanity import path:

$ ./bin/go version
go version go1.2.2 linux/amd64
$ ./bin/go get dmitri.shuralyov.com/temp/go-get-issue-unicode/испытание
$ echo $?
0
@FiloSottile

This comment has been minimized.

Copy link
Member

@FiloSottile FiloSottile commented Jun 14, 2019

There is a relevant passage in the cmd/go/internal/module docs by @rsc that mentions that the eventual plan is to allow Unicode letters.

// Although paths are disallowed from using Unicode (see pathOK above),
// the eventual plan is to allow Unicode letters as well, to assume that
// file systems and URLs are Unicode-safe (storing UTF-8), and apply
// the !-for-uppercase convention. Note however that not all runes that
// are different but case-fold equivalent are an upper/lower pair.
// For example, U+004B ('K'), U+006B ('k'), and U+212A ('K' for Kelvin)
// are considered to case-fold to each other. When we do add Unicode
// letters, we must not assume that upper/lower are the only case-equivalent pairs.
// Perhaps the Kelvin symbol would be disallowed entirely, for example.
// Or perhaps it would encode as "!!k", or perhaps as "(212A)".

I assume this is now targeting Go 1.14? Should it be a release-blocker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.