Skip to content

Commit 31acf44

Browse files
committed
Update linting
* Update golangci-lint from upstream prometheus repo. * Ignore min/max in predeclared. * Fix `Errorf()` use. Signed-off-by: SuperQ <superq@gmail.com>
1 parent dbf72fc commit 31acf44

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
3737
with:
3838
args: --verbose
39-
version: v1.59.1
39+
version: v1.60.2

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ linters-settings:
6666
local-prefixes: github.com/prometheus/client_golang
6767
gofumpt:
6868
extra-rules: true
69+
predeclared:
70+
ignore: "min,max"
6971
revive:
7072
rules:
7173
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter

Makefile.common

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v1.59.1
64+
GOLANGCI_LINT_VERSION ?= v1.60.2
6565
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6666
# windows isn't included here because of the path separator being different.
6767
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))

prometheus/graphite/bridge_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ prefix.name_bucket;constname=constvalue;labelname=val2;le=+Inf 3 1477043
238238
got := buf.String()
239239

240240
if err := checkLinesAreEqual(want, got, useTags); err != nil {
241-
t.Fatalf(err.Error())
241+
t.Fatal(err.Error())
242242
}
243243
}
244244

@@ -290,7 +290,7 @@ prefix.name;constname=constvalue;labelname=val2 1 1477043
290290
got := buf.String()
291291

292292
if err := checkLinesAreEqual(want, got, useTags); err != nil {
293-
t.Fatalf(err.Error())
293+
t.Fatal(err.Error())
294294
}
295295
}
296296

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

324324
if !reflect.DeepEqual(wantSplit, gotSplit) {
325-
return fmt.Errorf(log)
325+
return fmt.Error(log)
326326
}
327327
}
328328
return nil

prometheus/testutil/testutil.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func compare(got, want []*dto.MetricFamily) error {
310310
}
311311
}
312312
if diffErr := diff.Diff(gotBuf.String(), wantBuf.String()); diffErr != "" {
313-
return fmt.Errorf(diffErr)
313+
return fmt.Error(diffErr)
314314
}
315315
return nil
316316
}

0 commit comments

Comments
 (0)