From d7590aab3c040059dac7628c7037ffd9db368c01 Mon Sep 17 00:00:00 2001 From: Karsten Weiss Date: Fri, 13 Apr 2018 22:58:07 +0200 Subject: [PATCH] Fix three shadow variable warnings (govet -shadow) Fixes: http.go:118: declaration of "part" shadows declaration at http.go:117 http_test.go:50: declaration of "respBody" shadows declaration at http_test.go:25 promhttp/http.go:305: declaration of "part" shadows declaration at promhttp/http.go:304 Signed-off-by: Karsten Weiss --- prometheus/http.go | 2 +- prometheus/http_test.go | 4 ++-- prometheus/promhttp/http.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/prometheus/http.go b/prometheus/http.go index 3d47a81..4d08154 100644 --- a/prometheus/http.go +++ b/prometheus/http.go @@ -115,7 +115,7 @@ func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) header := request.Header.Get(acceptEncodingHeader) parts := strings.Split(header, ",") for _, part := range parts { - part := strings.TrimSpace(part) + part = strings.TrimSpace(part) if part == "gzip" || strings.HasPrefix(part, "gzip;") { return gzip.NewWriter(writer), "gzip" } diff --git a/prometheus/http_test.go b/prometheus/http_test.go index edd47ad..dd89ccf 100644 --- a/prometheus/http_test.go +++ b/prometheus/http_test.go @@ -47,9 +47,9 @@ func TestInstrumentHandler(t *testing.T) { instant := time.Now() end := instant.Add(30 * time.Second) now = nowSeries(instant, end) - respBody := respBody("Howdy there!") + body := respBody("Howdy there!") - hndlr := InstrumentHandler("test-handler", respBody) + hndlr := InstrumentHandler("test-handler", body) opts := SummaryOpts{ Subsystem: "http", diff --git a/prometheus/promhttp/http.go b/prometheus/promhttp/http.go index 8dc2603..0135737 100644 --- a/prometheus/promhttp/http.go +++ b/prometheus/promhttp/http.go @@ -302,7 +302,7 @@ func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled header := request.Header.Get(acceptEncodingHeader) parts := strings.Split(header, ",") for _, part := range parts { - part := strings.TrimSpace(part) + part = strings.TrimSpace(part) if part == "gzip" || strings.HasPrefix(part, "gzip;") { return gzip.NewWriter(writer), "gzip" }