Skip to content

Commit

Permalink
fix assorted oddities found by golangci-lint (#1040)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
xrstf authored Aug 3, 2022
1 parent c7488be commit 618194d
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 246 deletions.
18 changes: 17 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@ output:

linters:
enable:
- deadcode
- depguard
- durationcheck
- errorlint
- exportloopref
- gofmt
- gofumpt
- goimports
- revive
- gosimple
- ineffassign
- misspell
- nolintlint
- predeclared
- revive
- staticcheck
- structcheck
- unconvert
- unused
- varcheck
- wastedassign

issues:
max-same-issues: 0
Expand Down
2 changes: 1 addition & 1 deletion api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *httpClient) URL(ep string, args map[string]string) *url.URL {

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

u := *c.endpoint
Expand Down
4 changes: 2 additions & 2 deletions api/prometheus/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ func (h *httpAPI) Query(ctx context.Context, query string, ts time.Time, opts ..
}

var qres queryResult
return model.Value(qres.v), warnings, json.Unmarshal(body, &qres)
return qres.v, warnings, json.Unmarshal(body, &qres)
}

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

var qres queryResult

return model.Value(qres.v), warnings, json.Unmarshal(body, &qres)
return qres.v, warnings, json.Unmarshal(body, &qres)
}

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

0 comments on commit 618194d

Please sign in to comment.