From dd8d425fedd88970a7ee79e908eb47f6d1fcdcad Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 23 Nov 2021 03:00:32 +0000 Subject: all: fix some lint issues Make some code more simple. Change-Id: I801adf0dba5f6c515681345c732dbb907f945419 GitHub-Last-Rev: a505146baca00a1b3268d11d10510afa8cea6f1d GitHub-Pull-Request: golang/go#49626 Reviewed-on: https://go-review.googlesource.com/c/go/+/364634 Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: David Chase --- src/net/http/cookiejar/jar.go | 6 ++---- src/net/http/httputil/reverseproxy.go | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src/net/http') diff --git a/src/net/http/cookiejar/jar.go b/src/net/http/cookiejar/jar.go index 309dfcc0e1..c2393a0741 100644 --- a/src/net/http/cookiejar/jar.go +++ b/src/net/http/cookiejar/jar.go @@ -303,10 +303,8 @@ func canonicalHost(host string) (string, error) { return "", err } } - if strings.HasSuffix(host, ".") { - // Strip trailing dot from fully qualified domain names. - host = host[:len(host)-1] - } + // Strip trailing dot from fully qualified domain names. + host = strings.TrimSuffix(host, ".") encoded, err := toASCII(host) if err != nil { return "", err diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index b7244134f0..082490faaa 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -622,7 +622,6 @@ func (p *ReverseProxy) handleUpgradeResponse(rw http.ResponseWriter, req *http.R go spc.copyToBackend(errc) go spc.copyFromBackend(errc) <-errc - return } // switchProtocolCopier exists so goroutines proxying data back and -- cgit v1.3-5-g9baa