From 8251c0f79101e98f017f562a5e5c8479f8a71102 Mon Sep 17 00:00:00 2001 From: Marvin Stenger Date: Thu, 5 Oct 2017 15:50:11 +0200 Subject: [PATCH] all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" This reverts https://golang.org/cl/66372. Updates #22148 Change-Id: I3e94af3dfc11a2883bf28e1d5e1f32f98760b3ee Reviewed-on: https://go-review.googlesource.com/68431 Reviewed-by: Ian Lance Taylor --- handshake_client.go | 2 +- tls.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handshake_client.go b/handshake_client.go index 38d01bf..f8db662 100644 --- a/handshake_client.go +++ b/handshake_client.go @@ -848,7 +848,7 @@ func hostnameInSNI(name string) string { if len(host) > 0 && host[0] == '[' && host[len(host)-1] == ']' { host = host[1 : len(host)-1] } - if i := strings.LastIndexByte(host, '%'); i > 0 { + if i := strings.LastIndex(host, "%"); i > 0 { host = host[:i] } if net.ParseIP(host) != nil { diff --git a/tls.go b/tls.go index 1c91dae..615d1e5 100644 --- a/tls.go +++ b/tls.go @@ -122,7 +122,7 @@ func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (* return nil, err } - colonPos := strings.LastIndexByte(addr, ':') + colonPos := strings.LastIndex(addr, ":") if colonPos == -1 { colonPos = len(addr) }