From dd2279ee344a59ad50a73ebce5ab80c93fbbe732 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 12 Sep 2023 16:14:36 +0200 Subject: [PATCH] testing: use strings.LastIndexAny in (*common).decorate Change-Id: I14c521f4e599e14c71a52342b0ead5d0d4007f1e Reviewed-on: https://go-review.googlesource.com/c/go/+/527655 Auto-Submit: Tobias Klauser Reviewed-by: Kirill Kolyshkin Reviewed-by: Bryan Mills LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor --- src/testing/testing.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index 1bc8aff00d..d89a99454d 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -771,9 +771,7 @@ func (c *common) decorate(s string, skip int) string { if file != "" { if *fullPath { // If relative path, truncate file name at last file name separator. - } else if index := strings.LastIndex(file, "/"); index >= 0 { - file = file[index+1:] - } else if index = strings.LastIndex(file, "\\"); index >= 0 { + } else if index := strings.LastIndexAny(file, `/\`); index >= 0 { file = file[index+1:] } } else { -- 2.50.0