diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2023-09-12 16:14:36 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-09-13 18:06:09 +0000 |
| commit | dd2279ee344a59ad50a73ebce5ab80c93fbbe732 (patch) | |
| tree | 3cc1348129314108853347d3bede90e6425a89a1 /src/testing/testing.go | |
| parent | 3251006291c3e09c6ea40b6a65e5f05d9b9de573 (diff) | |
| download | go-dd2279ee344a59ad50a73ebce5ab80c93fbbe732.tar.xz | |
testing: use strings.LastIndexAny in (*common).decorate
Change-Id: I14c521f4e599e14c71a52342b0ead5d0d4007f1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/527655
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 4 |
1 files changed, 1 insertions, 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 { |
