]> Cypherpunks repositories - gostls13.git/commit
all: prefer strings.LastIndexByte over strings.LastIndex
authorMarvin Stenger <marvin.stenger94@gmail.com>
Mon, 25 Sep 2017 13:47:44 +0000 (15:47 +0200)
committerIan Lance Taylor <iant@golang.org>
Wed, 27 Sep 2017 00:54:24 +0000 (00:54 +0000)
commitd2826d3e068f096f4b5371175afb7e5d8c4aa73c
treee252245e001e359351b9a06891cadf6d725231b9
parente61c5e2f2044c7bc606ebdfbd0187598b90c50e5
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>
25 files changed:
src/archive/tar/writer.go
src/cmd/doc/main.go
src/cmd/fix/fix.go
src/cmd/vet/print.go
src/crypto/tls/handshake_client.go
src/crypto/tls/tls.go
src/debug/gosym/symtab.go
src/encoding/xml/marshal.go
src/go/build/build.go
src/go/doc/testdata/testing.go
src/go/printer/printer.go
src/go/types/resolver.go
src/internal/trace/parser.go
src/net/http/cookiejar/jar.go
src/net/http/cookiejar/jar_test.go
src/net/http/http.go
src/net/http/request.go
src/net/http/transport.go
src/net/mail/message.go
src/net/rpc/server.go
src/net/url/url.go
src/os/exec/lp_windows.go
src/path/path.go
src/testing/testing.go
src/time/mono_test.go