From d7983b094e269ec673ec47b1a7b25fafe85a024c Mon Sep 17 00:00:00 2001 From: Marvin Stenger Date: Thu, 21 Sep 2017 19:23:51 +0200 Subject: [PATCH] all: prefer bytes.IndexByte over bytes.Index bytes.IndexByte can be used wherever the second argument to strings.Index is exactly one byte long, so we do that with this change. This avoids generating unnecessary string symbols/converison and saves a few calls to bytes.Index. Change-Id: If31c775790e01edfece1169e398ad6a754fb4428 Reviewed-on: https://go-review.googlesource.com/66373 Run-TryBot: Brad Fitzpatrick Reviewed-by: Ian Lance Taylor --- handshake_client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handshake_client_test.go b/handshake_client_test.go index eaef8aa..cc3ab71 100644 --- a/handshake_client_test.go +++ b/handshake_client_test.go @@ -85,7 +85,7 @@ func (o *opensslOutputSink) Write(data []byte) (n int, err error) { o.all = append(o.all, data...) for { - i := bytes.Index(o.line, []byte{'\n'}) + i := bytes.IndexByte(o.line, '\n') if i < 0 { break }