]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/module: define fs-safe module path encoding
authorRuss Cox <rsc@golang.org>
Mon, 16 Jul 2018 02:56:37 +0000 (22:56 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 18 Jul 2018 02:08:57 +0000 (02:08 +0000)
commit203c16592bd20ec22ed407d445719b90585626b1
tree5c42ee154a0f499deef114320904bf6f5d16cd4f
parentce09ce4ae0116d2056e8864fe2c2fd3abbc5375a
cmd/go/internal/module: define fs-safe module path encoding

Module paths, like import paths, are case-sensitive, for better or worse.
But not all file systems distinguish file paths with different cases.
If we are going to use module paths to construct file system paths,
we must apply an encoding that distinguishes case without relying
upon the file system to do it.

This CL defines that encoding, the "safe module path encoding".
Module paths today are ASCII-only with limited punctuation,
so the safe module path encoding is to convert the whole path
to lower case and insert an ! before every formerly upper-case letter:
github.com/Sirupsen/logrus is stored as github.com/!sirupsen/logrus.

Although this CL defines the encoding, it does not change the rest
of the go command to use the encoding. That will be done in
follow-up CLs.

Change-Id: I06e6188dcfcbbc1d88674f7c95e1cb45cb476238
Reviewed-on: https://go-review.googlesource.com/124378
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/module/module.go
src/cmd/go/internal/module/module_test.go