]> Cypherpunks.ru repositories - gostls13.git/commitdiff
testing: use strings.LastIndexAny in (*common).decorate
authorTobias Klauser <tklauser@distanz.ch>
Tue, 12 Sep 2023 14:14:36 +0000 (16:14 +0200)
committerGopher Robot <gobot@golang.org>
Wed, 13 Sep 2023 18:06:09 +0000 (18:06 +0000)
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>
src/testing/testing.go

index 1bc8aff00d1085a78d9175bdb3fa502e81e08fdb..d89a99454dd755596e3b3e5fea44dd23abe207fe 100644 (file)
@@ -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 {