Skip to content

Commit

Permalink
Merge pull request #1603 from prometheus/superq/cleanup_lint
Browse files Browse the repository at this point in the history
Update linting
  • Loading branch information
ArthurSens authored Aug 31, 2024
2 parents dbf72fc + e080e48 commit ffc4cc6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
with:
args: --verbose
version: v1.59.1
version: v1.60.2
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ linters-settings:
local-prefixes: github.com/prometheus/client_golang
gofumpt:
extra-rules: true
predeclared:
ignore: "min,max"
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
Expand Down
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.59.1
GOLANGCI_LINT_VERSION ?= v1.60.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
Expand Down
7 changes: 4 additions & 3 deletions prometheus/graphite/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -238,7 +239,7 @@ prefix.name_bucket;constname=constvalue;labelname=val2;le=+Inf 3 1477043
got := buf.String()

if err := checkLinesAreEqual(want, got, useTags); err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
}

Expand Down Expand Up @@ -290,7 +291,7 @@ prefix.name;constname=constvalue;labelname=val2 1 1477043
got := buf.String()

if err := checkLinesAreEqual(want, got, useTags); err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
}

Expand Down Expand Up @@ -322,7 +323,7 @@ func checkLinesAreEqual(w, g string, useTags bool) error {
log += fmt.Sprintf("want: %v\ngot: %v\n\n", wantSplit, gotSplit)

if !reflect.DeepEqual(wantSplit, gotSplit) {
return fmt.Errorf(log)
return errors.New(log)
}
}
return nil
Expand Down
3 changes: 2 additions & 1 deletion prometheus/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ package testutil

import (
"bytes"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -310,7 +311,7 @@ func compare(got, want []*dto.MetricFamily) error {
}
}
if diffErr := diff.Diff(gotBuf.String(), wantBuf.String()); diffErr != "" {
return fmt.Errorf(diffErr)
return errors.New(diffErr)
}
return nil
}
Expand Down

0 comments on commit ffc4cc6

Please sign in to comment.