Skip to content

Commit 607370a

Browse files
committed
module: use strings.ContainsRune in fileNameOK
As suggested by Ian for similar code on CL 326010. Change-Id: I7c6ca4191481daf253eba5f12e7079f5c3522e88 Reviewed-on: https://go-review.googlesource.com/c/mod/+/327029 Trust: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 98d530a commit 607370a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

module/module.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,7 @@ func fileNameOK(r rune) bool {
286286
if '0' <= r && r <= '9' || 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' {
287287
return true
288288
}
289-
for i := 0; i < len(allowed); i++ {
290-
if rune(allowed[i]) == r {
291-
return true
292-
}
293-
}
294-
return false
289+
return strings.ContainsRune(allowed, r)
295290
}
296291
// It may be OK to add more ASCII punctuation here, but only carefully.
297292
// For example Windows disallows < > \, and macOS disallows :, so we must not allow those.

0 commit comments

Comments
 (0)