summaryrefslogtreecommitdiff
path: root/src/cmd/fix
diff options
context:
space:
mode:
authorMarvin Stenger <marvin.stenger94@gmail.com>2017-09-25 15:47:44 +0200
committerIan Lance Taylor <iant@golang.org>2017-09-27 00:54:24 +0000
commitd2826d3e068f096f4b5371175afb7e5d8c4aa73c (patch)
treee252245e001e359351b9a06891cadf6d725231b9 /src/cmd/fix
parente61c5e2f2044c7bc606ebdfbd0187598b90c50e5 (diff)
downloadgo-git-d2826d3e068f096f4b5371175afb7e5d8c4aa73c.tar.gz
all: prefer strings.LastIndexByte over strings.LastIndex
strings.LastIndexByte was introduced in go1.5 and it can be used effectively wherever the second argument to strings.LastIndex is exactly one byte long. This avoids generating unnecessary string symbols and saves a few calls to strings.LastIndex. Change-Id: I7b5679d616197b055cffe6882a8675d24a98b574 Reviewed-on: https://go-review.googlesource.com/66372 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/fix')
-rw-r--r--src/cmd/fix/fix.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/fix/fix.go b/src/cmd/fix/fix.go
index cdc3c839d3..f12d1c7fe0 100644
--- a/src/cmd/fix/fix.go
+++ b/src/cmd/fix/fix.go
@@ -719,7 +719,7 @@ func usesImport(f *ast.File, path string) (used bool) {
case "<nil>":
// If the package name is not explicitly specified,
// make an educated guess. This is not guaranteed to be correct.
- lastSlash := strings.LastIndex(path, "/")
+ lastSlash := strings.LastIndexByte(path, '/')
if lastSlash == -1 {
name = path
} else {