diff options
| author | Marvin Stenger <marvin.stenger94@gmail.com> | 2017-09-25 15:47:44 +0200 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-09-27 00:54:24 +0000 |
| commit | d2826d3e068f096f4b5371175afb7e5d8c4aa73c (patch) | |
| tree | e252245e001e359351b9a06891cadf6d725231b9 /src/os/exec | |
| parent | e61c5e2f2044c7bc606ebdfbd0187598b90c50e5 (diff) | |
| download | go-d2826d3e068f096f4b5371175afb7e5d8c4aa73c.tar.xz | |
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/os/exec')
| -rw-r--r-- | src/os/exec/lp_windows.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/exec/lp_windows.go b/src/os/exec/lp_windows.go index 793d4d98b3..4e1ffb0014 100644 --- a/src/os/exec/lp_windows.go +++ b/src/os/exec/lp_windows.go @@ -26,7 +26,7 @@ func chkStat(file string) error { } func hasExt(file string) bool { - i := strings.LastIndex(file, ".") + i := strings.LastIndexByte(file, '.') if i < 0 { return false } |
