Using the same method CleanPatterns harmonizes further accepted format of patterns in go command.
Fixes #24233
Change-Id: Idb8176df3a7949b16764cd6ea51d7a8966799e42
Reviewed-on: https://go-review.googlesource.com/c/go/+/669775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
patterns[i] = p
}
}
+ patterns = search.CleanPatterns(patterns)
// Query the module providing the first argument, load its go.mod file, and
// check that it doesn't contain directives that would cause it to be
if filepath.IsAbs(p) {
p = filepath.Clean(p)
} else {
- if filepath.Separator == '\\' {
- p = strings.ReplaceAll(p, `\`, `/`)
- }
+ p = strings.ReplaceAll(p, `\`, `/`)
// Put argument in canonical form, but preserve leading ./.
if strings.HasPrefix(p, "./") {
--- /dev/null
+# Issue #24233: allow backslash in path of command
+go install -n rsc.io\fortune@v1.0.0
+! stderr 'malformed'
+
+mkdir m
+cd m
+go mod init example.com/m
+go get rsc.io\fortune
+! stderr 'malformed'
+
+go install -n rsc.io\fortune@v1.0.0
+! stderr 'malformed'