diff options
author | SataQiu <shidaqiu2018@gmail.com> | 2021-04-15 23:39:30 +0800 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-04-27 21:16:55 +0000 |
commit | 30002e665658b4b2c147caaee6bf7734042952e8 (patch) | |
tree | 0ebd3c532935634521efe6c8d184f98f1efe2d49 /src/cmd/go/internal/modload/init.go | |
parent | b9dfaf77f55fb00173ae18b0dac9d43e7e5855c1 (diff) | |
download | go-30002e665658b4b2c147caaee6bf7734042952e8.tar.gz go-30002e665658b4b2c147caaee6bf7734042952e8.zip |
cmd/go/internal/modload: treat \ as a path separator instead of a shell special character
According to the code comment, \ should be treated as a path separator.
See fileNameOK in golang.org/x/mod/module/module.go.
Change-Id: I05e05246005191ecccfecf46848aba5cb1359956
Reviewed-on: https://go-review.googlesource.com/c/go/+/310429
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/init.go')
-rw-r--r-- | src/cmd/go/internal/modload/init.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 4d240a7b64..3c7db6c8a7 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -554,7 +554,7 @@ func checkModulePathLax(p string) error { // with file systems and subcommands. Disallow file path separators : and \ // because path separators other than / will confuse the module cache. // See fileNameOK in golang.org/x/mod/module/module.go. - shellChars := "`" + `\"'*<>?|` + shellChars := "`" + `"'*<>?|` fsChars := `\:` if i := strings.IndexAny(p, shellChars); i >= 0 { return errorf("contains disallowed shell character %q", p[i]) |