Skip to content

Update linting #1603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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