Skip to content

Commit 503f4f5

Browse files
committed
use strings.ReplaceAll in import.go
1 parent df8fc3e commit 503f4f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

import.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func importPathsNoDotExpansion(args []string) []string {
132132
// as a courtesy to Windows developers, rewrite \ to /
133133
// in command-line arguments. Handles .\... and so on.
134134
if filepath.Separator == '\\' {
135-
a = strings.Replace(a, `\`, `/`, -1)
135+
a = strings.ReplaceAll(a, `\`, `/`)
136136
}
137137

138138
// Put argument in canonical form, but preserve leading ./.
@@ -177,7 +177,7 @@ func importPaths(args []string) []string {
177177
// is no other special syntax.
178178
func matchPattern(pattern string) func(name string) bool {
179179
re := regexp.QuoteMeta(pattern)
180-
re = strings.Replace(re, `\.\.\.`, `.*`, -1)
180+
re = strings.ReplaceAll(re, `\.\.\.`, `.*`)
181181
// Special case: foo/... matches foo too.
182182
if strings.HasSuffix(re, `/.*`) {
183183
re = re[:len(re)-len(`/.*`)] + `(/.*)?`

0 commit comments

Comments
 (0)