diff options
author | Marvin Stenger <marvin.stenger94@gmail.com> | 2017-09-21 19:01:27 +0200 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2017-09-25 17:35:41 +0000 |
commit | f22ba1f24786be600bfa3686a7ce5a318a96b9c9 (patch) | |
tree | 06dd4fd49b65d66491a3674f8ed440fd44f52cc5 /src/cmd/doc | |
parent | 5e92c411284f1757c3531a70530170f1079ee5fc (diff) | |
download | go-f22ba1f24786be600bfa3686a7ce5a318a96b9c9.tar.gz go-f22ba1f24786be600bfa3686a7ce5a318a96b9c9.zip |
all: prefer strings.IndexByte over strings.Index
strings.IndexByte was introduced in go1.2 and it can be used
effectively wherever the second argument to strings.Index is
exactly one byte long.
This avoids generating unnecessary string symbols and saves
a few calls to strings.Index.
Change-Id: I1ab5edb7c4ee9058084cfa57cbcc267c2597e793
Reviewed-on: https://go-review.googlesource.com/65930
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/doc')
-rw-r--r-- | src/cmd/doc/main.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/doc/main.go b/src/cmd/doc/main.go index de275403a2..09f551a45d 100644 --- a/src/cmd/doc/main.go +++ b/src/cmd/doc/main.go @@ -215,7 +215,7 @@ func parseArgs(args []string) (pkg *build.Package, path, symbol string, more boo // slash+1: if there's no slash, the value is -1 and start is 0; otherwise // start is the byte after the slash. for start := slash + 1; start < len(arg); start = period + 1 { - period = strings.Index(arg[start:], ".") + period = strings.IndexByte(arg[start:], '.') symbol := "" if period < 0 { period = len(arg) |