mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -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
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -42,12 +40,6 @@ func newPrometheusHTTPClient(serverURL string) (*prometheusHTTPClient, error) {
|
|||
}, 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 {
|
||||
return c.httpClient.URL(path, nil).String()
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ func (m *SDMock) HandleHypervisorListSuccessfully() {
|
|||
testHeader(m.t, r, "X-Auth-Token", tokenID)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
fmt.Fprintf(w, listOutput)
|
||||
fmt.Fprint(w, listOutput)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -326,17 +326,15 @@ var errUnexpected = errors.New("unexpected error")
|
|||
// recover is the handler that turns panics into returns from the top level of Parse.
|
||||
func (p *parser) recover(errp *error) {
|
||||
e := recover()
|
||||
if e != nil {
|
||||
if _, ok := e.(runtime.Error); ok {
|
||||
// Print the stack trace but do not inhibit the running application.
|
||||
buf := make([]byte, 64<<10)
|
||||
buf = buf[:runtime.Stack(buf, false)]
|
||||
if _, ok := e.(runtime.Error); ok {
|
||||
// Print the stack trace but do not inhibit the running application.
|
||||
buf := make([]byte, 64<<10)
|
||||
buf = buf[:runtime.Stack(buf, false)]
|
||||
|
||||
fmt.Fprintf(os.Stderr, "parser panic: %v\n%s", e, buf)
|
||||
*errp = errUnexpected
|
||||
} else {
|
||||
*errp = e.(error)
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "parser panic: %v\n%s", e, buf)
|
||||
*errp = errUnexpected
|
||||
} else if e != nil {
|
||||
*errp = e.(error)
|
||||
}
|
||||
p.lex.close()
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import (
|
|||
|
||||
var scenarios = map[string]struct {
|
||||
params string
|
||||
accept string
|
||||
externalLabels labels.Labels
|
||||
code int
|
||||
body string
|
||||
|
|
Loading…
Reference in a new issue