]> Cypherpunks repositories - gostls13.git/commit
all: prefer strings.IndexByte over strings.Index
authorMarvin Stenger <marvin.stenger94@gmail.com>
Thu, 21 Sep 2017 17:01:27 +0000 (19:01 +0200)
committerIan Lance Taylor <iant@golang.org>
Mon, 25 Sep 2017 17:35:41 +0000 (17:35 +0000)
commitf22ba1f24786be600bfa3686a7ce5a318a96b9c9
tree06dd4fd49b65d66491a3674f8ed440fd44f52cc5
parent5e92c411284f1757c3531a70530170f1079ee5fc
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>
55 files changed:
src/cmd/api/goapi.go
src/cmd/cgo/gcc.go
src/cmd/cgo/godefs.go
src/cmd/compile/fmt_test.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/compile/internal/syntax/nodes_test.go
src/cmd/dist/main.go
src/cmd/doc/main.go
src/cmd/fix/fix.go
src/cmd/fix/typecheck.go
src/cmd/go/go_test.go
src/cmd/go/internal/base/base.go
src/cmd/go/internal/cmdflag/flag.go
src/cmd/go/internal/get/get.go
src/cmd/go/internal/get/vcs.go
src/cmd/go/internal/load/match_test.go
src/cmd/go/internal/load/pkg.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/ld.go
src/cmd/vet/asmdecl.go
src/cmd/vet/print.go
src/cmd/vet/structtag.go
src/crypto/x509/pem_decrypt.go
src/crypto/x509/root_darwin_arm_gen.go
src/debug/gosym/symtab.go
src/encoding/json/tags.go
src/encoding/xml/typeinfo.go
src/encoding/xml/xml.go
src/go/build/build.go
src/go/printer/printer.go
src/html/template/js.go
src/math/big/ratconv.go
src/mime/encodedword.go
src/mime/mediatype.go
src/net/http/cgi/child.go
src/net/http/cookie.go
src/net/http/fs.go
src/net/http/request.go
src/net/http/server.go
src/net/lookup_test.go
src/net/url/url.go
src/os/env_test.go
src/os/exec/exec.go
src/os/os_test.go
src/os/user/cgo_lookup_unix.go
src/os/user/lookup_unix.go
src/regexp/exec_test.go
src/regexp/regexp.go
src/runtime/pprof/pprof_test.go
src/unicode/maketables.go