aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api
diff options
context:
space:
mode:
authorMarvin Stenger <marvin.stenger94@gmail.com>2017-09-21 19:01:27 +0200
committerIan Lance Taylor <iant@golang.org>2017-09-25 17:35:41 +0000
commitf22ba1f24786be600bfa3686a7ce5a318a96b9c9 (patch)
tree06dd4fd49b65d66491a3674f8ed440fd44f52cc5 /src/cmd/api
parent5e92c411284f1757c3531a70530170f1079ee5fc (diff)
downloadgo-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/api')
-rw-r--r--src/cmd/api/goapi.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go
index 8cc78c01ed..a47909b270 100644
--- a/src/cmd/api/goapi.go
+++ b/src/cmd/api/goapi.go
@@ -189,7 +189,7 @@ func main() {
features = append(features, f)
continue
}
- comma := strings.Index(f, ",")
+ comma := strings.IndexByte(f, ',')
for cname := range cmap {
f2 := fmt.Sprintf("%s (%s)%s", f[:comma], cname, f[comma:])
features = append(features, f2)