mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Fix staticcheck errors
Not sure why they only show up now. Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
This commit is contained in:
parent
335a34486e
commit
a92ef68dd8
|
@ -14,8 +14,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -42,12 +40,6 @@ func newPrometheusHTTPClient(serverURL string) (*prometheusHTTPClient, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *prometheusHTTPClient) do(req *http.Request) (*http.Response, []byte, error) {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), c.requestTimeout)
|
|
||||||
defer cancel()
|
|
||||||
return c.httpClient.Do(ctx, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *prometheusHTTPClient) urlJoin(path string) string {
|
func (c *prometheusHTTPClient) urlJoin(path string) string {
|
||||||
return c.httpClient.URL(path, nil).String()
|
return c.httpClient.URL(path, nil).String()
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ func (m *SDMock) HandleHypervisorListSuccessfully() {
|
||||||
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
fmt.Fprintf(w, hypervisorListBody)
|
fmt.Fprint(w, hypervisorListBody)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ func (m *SDMock) HandleServerListSuccessfully() {
|
||||||
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
fmt.Fprintf(w, serverListBody)
|
fmt.Fprint(w, serverListBody)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,6 +583,6 @@ func (m *SDMock) HandleFloatingIPListSuccessfully() {
|
||||||
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
fmt.Fprintf(w, listOutput)
|
fmt.Fprint(w, listOutput)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,7 +326,6 @@ var errUnexpected = errors.New("unexpected error")
|
||||||
// recover is the handler that turns panics into returns from the top level of Parse.
|
// recover is the handler that turns panics into returns from the top level of Parse.
|
||||||
func (p *parser) recover(errp *error) {
|
func (p *parser) recover(errp *error) {
|
||||||
e := recover()
|
e := recover()
|
||||||
if e != nil {
|
|
||||||
if _, ok := e.(runtime.Error); ok {
|
if _, ok := e.(runtime.Error); ok {
|
||||||
// Print the stack trace but do not inhibit the running application.
|
// Print the stack trace but do not inhibit the running application.
|
||||||
buf := make([]byte, 64<<10)
|
buf := make([]byte, 64<<10)
|
||||||
|
@ -334,10 +333,9 @@ func (p *parser) recover(errp *error) {
|
||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "parser panic: %v\n%s", e, buf)
|
fmt.Fprintf(os.Stderr, "parser panic: %v\n%s", e, buf)
|
||||||
*errp = errUnexpected
|
*errp = errUnexpected
|
||||||
} else {
|
} else if e != nil {
|
||||||
*errp = e.(error)
|
*errp = e.(error)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
p.lex.close()
|
p.lex.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import (
|
||||||
|
|
||||||
var scenarios = map[string]struct {
|
var scenarios = map[string]struct {
|
||||||
params string
|
params string
|
||||||
accept string
|
|
||||||
externalLabels labels.Labels
|
externalLabels labels.Labels
|
||||||
code int
|
code int
|
||||||
body string
|
body string
|
||||||
|
|
Loading…
Reference in a new issue