Merge pull request #1603 from prometheus/superq/cleanup_lint
Update linting
This commit is contained in:
commit
ffc4cc6470
|
@ -36,4 +36,4 @@ jobs:
|
||||||
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
|
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
|
||||||
with:
|
with:
|
||||||
args: --verbose
|
args: --verbose
|
||||||
version: v1.59.1
|
version: v1.60.2
|
||||||
|
|
|
@ -66,6 +66,8 @@ linters-settings:
|
||||||
local-prefixes: github.com/prometheus/client_golang
|
local-prefixes: github.com/prometheus/client_golang
|
||||||
gofumpt:
|
gofumpt:
|
||||||
extra-rules: true
|
extra-rules: true
|
||||||
|
predeclared:
|
||||||
|
ignore: "min,max"
|
||||||
revive:
|
revive:
|
||||||
rules:
|
rules:
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
|
||||||
|
|
|
@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
|
||||||
SKIP_GOLANGCI_LINT :=
|
SKIP_GOLANGCI_LINT :=
|
||||||
GOLANGCI_LINT :=
|
GOLANGCI_LINT :=
|
||||||
GOLANGCI_LINT_OPTS ?=
|
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.
|
# 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.
|
# windows isn't included here because of the path separator being different.
|
||||||
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
|
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
|
||||||
|
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
@ -238,7 +239,7 @@ prefix.name_bucket;constname=constvalue;labelname=val2;le=+Inf 3 1477043
|
||||||
got := buf.String()
|
got := buf.String()
|
||||||
|
|
||||||
if err := checkLinesAreEqual(want, got, useTags); err != nil {
|
if err := checkLinesAreEqual(want, got, useTags); err != nil {
|
||||||
t.Fatalf(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +291,7 @@ prefix.name;constname=constvalue;labelname=val2 1 1477043
|
||||||
got := buf.String()
|
got := buf.String()
|
||||||
|
|
||||||
if err := checkLinesAreEqual(want, got, useTags); err != nil {
|
if err := checkLinesAreEqual(want, got, useTags); err != nil {
|
||||||
t.Fatalf(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +323,7 @@ func checkLinesAreEqual(w, g string, useTags bool) error {
|
||||||
log += fmt.Sprintf("want: %v\ngot: %v\n\n", wantSplit, gotSplit)
|
log += fmt.Sprintf("want: %v\ngot: %v\n\n", wantSplit, gotSplit)
|
||||||
|
|
||||||
if !reflect.DeepEqual(wantSplit, gotSplit) {
|
if !reflect.DeepEqual(wantSplit, gotSplit) {
|
||||||
return fmt.Errorf(log)
|
return errors.New(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -39,6 +39,7 @@ package testutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -310,7 +311,7 @@ func compare(got, want []*dto.MetricFamily) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if diffErr := diff.Diff(gotBuf.String(), wantBuf.String()); diffErr != "" {
|
if diffErr := diff.Diff(gotBuf.String(), wantBuf.String()); diffErr != "" {
|
||||||
return fmt.Errorf(diffErr)
|
return errors.New(diffErr)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue