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/os/exec/exec.go | |
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/os/exec/exec.go')
-rw-r--r-- | src/os/exec/exec.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go index b0fe14d6fd..bd07a6a73d 100644 --- a/src/os/exec/exec.go +++ b/src/os/exec/exec.go @@ -687,7 +687,7 @@ func dedupEnvCase(caseInsensitive bool, env []string) []string { out := make([]string, 0, len(env)) saw := map[string]int{} // key => index into out for _, kv := range env { - eq := strings.Index(kv, "=") + eq := strings.IndexByte(kv, '=') if eq < 0 { out = append(out, kv) continue |