Skip to content

Commit 618194d

Browse files
authored
fix assorted oddities found by golangci-lint (#1040)
* fix assorted oddities found by golangci-lint Signed-off-by: Christoph Mewes <[email protected]> * permanently enable the linters Signed-off-by: Christoph Mewes <[email protected]> * post-rebase blues Signed-off-by: Christoph Mewes <[email protected]>
1 parent c7488be commit 618194d

19 files changed

+111
-246
lines changed

.golangci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,26 @@ output:
88

99
linters:
1010
enable:
11+
- deadcode
12+
- depguard
13+
- durationcheck
14+
- errorlint
15+
- exportloopref
16+
- gofmt
1117
- gofumpt
1218
- goimports
13-
- revive
19+
- gosimple
20+
- ineffassign
1421
- misspell
22+
- nolintlint
23+
- predeclared
24+
- revive
25+
- staticcheck
26+
- structcheck
27+
- unconvert
28+
- unused
29+
- varcheck
30+
- wastedassign
1531

1632
issues:
1733
max-same-issues: 0

api/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (c *httpClient) URL(ep string, args map[string]string) *url.URL {
109109

110110
for arg, val := range args {
111111
arg = ":" + arg
112-
p = strings.Replace(p, arg, val, -1)
112+
p = strings.ReplaceAll(p, arg, val)
113113
}
114114

115115
u := *c.endpoint

api/prometheus/v1/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ func (h *httpAPI) Query(ctx context.Context, query string, ts time.Time, opts ..
856856
}
857857

858858
var qres queryResult
859-
return model.Value(qres.v), warnings, json.Unmarshal(body, &qres)
859+
return qres.v, warnings, json.Unmarshal(body, &qres)
860860
}
861861

862862
func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range, opts ...Option) (model.Value, Warnings, error) {
@@ -885,7 +885,7 @@ func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range, opts ..
885885

886886
var qres queryResult
887887

888-
return model.Value(qres.v), warnings, json.Unmarshal(body, &qres)
888+
return qres.v, warnings, json.Unmarshal(body, &qres)
889889
}
890890

891891
func (h *httpAPI) Series(ctx context.Context, matches []string, startTime, endTime time.Time) ([]model.LabelSet, Warnings, error) {

0 commit comments

Comments
 (0)