Skip to content

Commit dd2279e

Browse files
tklausergopherbot
authored andcommitted
testing: use strings.LastIndexAny in (*common).decorate
Change-Id: I14c521f4e599e14c71a52342b0ead5d0d4007f1e Reviewed-on: https://go-review.googlesource.com/c/go/+/527655 Auto-Submit: Tobias Klauser <[email protected]> Reviewed-by: Kirill Kolyshkin <[email protected]> Reviewed-by: Bryan Mills <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 3251006 commit dd2279e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/testing/testing.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,7 @@ func (c *common) decorate(s string, skip int) string {
771771
if file != "" {
772772
if *fullPath {
773773
// If relative path, truncate file name at last file name separator.
774-
} else if index := strings.LastIndex(file, "/"); index >= 0 {
775-
file = file[index+1:]
776-
} else if index = strings.LastIndex(file, "\\"); index >= 0 {
774+
} else if index := strings.LastIndexAny(file, `/\`); index >= 0 {
777775
file = file[index+1:]
778776
}
779777
} else {

0 commit comments

Comments
 (0)