@@ -12,10 +12,13 @@ import (
12
12
)
13
13
14
14
// The following functions are copied verbatim from cmd/go/internal/module/module.go,
15
- // with one change to additionally reject Windows short-names.
15
+ // with a change to additionally reject Windows short-names,
16
+ // and one to accept arbitrary letters (golang.org/issue/29101).
16
17
//
17
18
// TODO(bcmills): After the call site for this function is backported,
18
19
// consolidate this back down to a single copy.
20
+ //
21
+ // NOTE: DO NOT MERGE THESE UNTIL WE DECIDE ABOUT ARBITRARY LETTERS IN MODULE MODE.
19
22
20
23
// CheckImportPath checks that an import path is valid.
21
24
func CheckImportPath (path string ) error {
@@ -120,18 +123,16 @@ func checkElem(elem string, fileName bool) error {
120
123
}
121
124
122
125
// pathOK reports whether r can appear in an import path element.
123
- // Paths can be ASCII letters, ASCII digits, and limited ASCII punctuation: + - . _ and ~.
124
- // This matches what "go get" has historically recognized in import paths.
125
- // TODO(rsc): We would like to allow Unicode letters, but that requires additional
126
- // care in the safe encoding (see note below).
126
+ //
127
+ // NOTE: This function DIVERGES from module mode pathOK by accepting Unicode letters.
127
128
func pathOK (r rune ) bool {
128
129
if r < utf8 .RuneSelf {
129
130
return r == '+' || r == '-' || r == '.' || r == '_' || r == '~' ||
130
131
'0' <= r && r <= '9' ||
131
132
'A' <= r && r <= 'Z' ||
132
133
'a' <= r && r <= 'z'
133
134
}
134
- return false
135
+ return unicode . IsLetter ( r )
135
136
}
136
137
137
138
// fileNameOK reports whether r can appear in a file name.
0 commit comments