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 <knweiss@gmail.com>
This commit is contained in:
Karsten Weiss 2018-04-13 22:58:07 +02:00
parent f3a13af35c
commit d7590aab3c
3 changed files with 4 additions and 4 deletions

View File

@ -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"
}

View File

@ -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",

View File

@ -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"
}