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:
parent
f3a13af35c
commit
d7590aab3c
|
@ -115,7 +115,7 @@ func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string)
|
||||||
header := request.Header.Get(acceptEncodingHeader)
|
header := request.Header.Get(acceptEncodingHeader)
|
||||||
parts := strings.Split(header, ",")
|
parts := strings.Split(header, ",")
|
||||||
for _, part := range parts {
|
for _, part := range parts {
|
||||||
part := strings.TrimSpace(part)
|
part = strings.TrimSpace(part)
|
||||||
if part == "gzip" || strings.HasPrefix(part, "gzip;") {
|
if part == "gzip" || strings.HasPrefix(part, "gzip;") {
|
||||||
return gzip.NewWriter(writer), "gzip"
|
return gzip.NewWriter(writer), "gzip"
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,9 @@ func TestInstrumentHandler(t *testing.T) {
|
||||||
instant := time.Now()
|
instant := time.Now()
|
||||||
end := instant.Add(30 * time.Second)
|
end := instant.Add(30 * time.Second)
|
||||||
now = nowSeries(instant, end)
|
now = nowSeries(instant, end)
|
||||||
respBody := respBody("Howdy there!")
|
body := respBody("Howdy there!")
|
||||||
|
|
||||||
hndlr := InstrumentHandler("test-handler", respBody)
|
hndlr := InstrumentHandler("test-handler", body)
|
||||||
|
|
||||||
opts := SummaryOpts{
|
opts := SummaryOpts{
|
||||||
Subsystem: "http",
|
Subsystem: "http",
|
||||||
|
|
|
@ -302,7 +302,7 @@ func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled
|
||||||
header := request.Header.Get(acceptEncodingHeader)
|
header := request.Header.Get(acceptEncodingHeader)
|
||||||
parts := strings.Split(header, ",")
|
parts := strings.Split(header, ",")
|
||||||
for _, part := range parts {
|
for _, part := range parts {
|
||||||
part := strings.TrimSpace(part)
|
part = strings.TrimSpace(part)
|
||||||
if part == "gzip" || strings.HasPrefix(part, "gzip;") {
|
if part == "gzip" || strings.HasPrefix(part, "gzip;") {
|
||||||
return gzip.NewWriter(writer), "gzip"
|
return gzip.NewWriter(writer), "gzip"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue