mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Upgrade to golangci-lint v1.59.0
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
parent
8894d65cd6
commit
b2396c0c8f
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -175,7 +175,7 @@ jobs:
|
|||
with:
|
||||
args: --verbose
|
||||
# Make sure to sync this with Makefile.common and scripts/golangci-lint.yml.
|
||||
version: v1.56.2
|
||||
version: v1.59.0
|
||||
fuzzing:
|
||||
uses: ./.github/workflows/fuzzing.yml
|
||||
if: github.event_name == 'pull_request'
|
||||
|
|
|
@ -47,7 +47,7 @@ issues:
|
|||
source: "^// ==="
|
||||
- linters:
|
||||
- perfsprint
|
||||
text: "fmt.Sprintf can be replaced with string addition"
|
||||
text: "fmt.Sprintf can be replaced with string concatenation"
|
||||
linters-settings:
|
||||
depguard:
|
||||
rules:
|
||||
|
|
|
@ -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.56.2
|
||||
GOLANGCI_LINT_VERSION ?= v1.59.0
|
||||
# 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))
|
||||
|
|
|
@ -296,7 +296,7 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
if p.exactQueryCount() {
|
||||
require.Equal(t, 1, qc)
|
||||
} else {
|
||||
require.Greater(t, qc, 0, "no queries logged")
|
||||
require.Positive(t, qc, "no queries logged")
|
||||
}
|
||||
p.validateLastQuery(t, ql)
|
||||
|
||||
|
@ -366,7 +366,7 @@ func (p *queryLogTest) run(t *testing.T) {
|
|||
if p.exactQueryCount() {
|
||||
require.Equal(t, 1, qc)
|
||||
} else {
|
||||
require.Greater(t, qc, 0, "no queries logged")
|
||||
require.Positive(t, qc, "no queries logged")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,4 +35,4 @@ jobs:
|
|||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
|
||||
with:
|
||||
version: v1.56.2
|
||||
version: v1.59.0
|
||||
|
|
|
@ -55,7 +55,7 @@ func (q *writeJobQueue) assertInvariants(t *testing.T) {
|
|||
require.Len(t, s.segment, s.nextWrite)
|
||||
}
|
||||
// Last segment must have at least one element, or we wouldn't have created it.
|
||||
require.Greater(t, s.nextWrite, 0)
|
||||
require.Positive(t, s.nextWrite)
|
||||
}
|
||||
|
||||
require.Equal(t, q.size, totalSize)
|
||||
|
|
|
@ -4574,7 +4574,7 @@ func TestOOOCompaction(t *testing.T) {
|
|||
ms, created, err := db.head.getOrCreate(lbls.Hash(), lbls)
|
||||
require.NoError(t, err)
|
||||
require.False(t, created)
|
||||
require.Greater(t, ms.ooo.oooHeadChunk.chunk.NumSamples(), 0)
|
||||
require.Positive(t, ms.ooo.oooHeadChunk.chunk.NumSamples())
|
||||
require.Len(t, ms.ooo.oooMmappedChunks, 14) // 7 original, 7 duplicate.
|
||||
}
|
||||
checkNonEmptyOOOChunk(series1)
|
||||
|
@ -4715,7 +4715,7 @@ func TestOOOCompactionWithNormalCompaction(t *testing.T) {
|
|||
ms, created, err := db.head.getOrCreate(lbls.Hash(), lbls)
|
||||
require.NoError(t, err)
|
||||
require.False(t, created)
|
||||
require.Greater(t, ms.ooo.oooHeadChunk.chunk.NumSamples(), 0)
|
||||
require.Positive(t, ms.ooo.oooHeadChunk.chunk.NumSamples())
|
||||
}
|
||||
|
||||
// If the normal Head is not compacted, the OOO head compaction does not take place.
|
||||
|
@ -4816,7 +4816,7 @@ func TestOOOCompactionWithDisabledWriteLog(t *testing.T) {
|
|||
ms, created, err := db.head.getOrCreate(lbls.Hash(), lbls)
|
||||
require.NoError(t, err)
|
||||
require.False(t, created)
|
||||
require.Greater(t, ms.ooo.oooHeadChunk.chunk.NumSamples(), 0)
|
||||
require.Positive(t, ms.ooo.oooHeadChunk.chunk.NumSamples())
|
||||
}
|
||||
|
||||
// If the normal Head is not compacted, the OOO head compaction does not take place.
|
||||
|
@ -5517,8 +5517,8 @@ func TestWBLAndMmapReplay(t *testing.T) {
|
|||
addedRecs++
|
||||
require.NoError(t, newWbl.Log(rec))
|
||||
}
|
||||
require.Greater(t, markers, 0)
|
||||
require.Greater(t, addedRecs, 0)
|
||||
require.Positive(t, markers)
|
||||
require.Positive(t, addedRecs)
|
||||
require.NoError(t, newWbl.Close())
|
||||
require.NoError(t, sr.Close())
|
||||
require.NoError(t, os.RemoveAll(wblDir))
|
||||
|
|
|
@ -3557,7 +3557,7 @@ func TestHistogramInWALAndMmapChunk(t *testing.T) {
|
|||
expMmapChunks = append(expMmapChunks, &cpy)
|
||||
}
|
||||
expHeadChunkSamples := ms.headChunks.chunk.NumSamples()
|
||||
require.Greater(t, expHeadChunkSamples, 0)
|
||||
require.Positive(t, expHeadChunkSamples)
|
||||
|
||||
// Series with mix of histograms and float.
|
||||
s2 := labels.FromStrings("a", "b2")
|
||||
|
@ -4638,7 +4638,7 @@ func TestChunkSnapshotTakenAfterIncompleteSnapshot(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.NotEqual(t, "", name)
|
||||
require.Equal(t, 0, idx)
|
||||
require.Greater(t, offset, 0)
|
||||
require.Positive(t, offset)
|
||||
}
|
||||
|
||||
// TestWBLReplay checks the replay at a low level.
|
||||
|
|
|
@ -251,7 +251,7 @@ func TestCheckpoint(t *testing.T) {
|
|||
require.NoError(t, w.Truncate(107))
|
||||
require.NoError(t, DeleteCheckpoints(w.Dir(), 106))
|
||||
require.Equal(t, histogramsInWAL+floatHistogramsInWAL+samplesInWAL, stats.TotalSamples)
|
||||
require.Greater(t, stats.DroppedSamples, 0)
|
||||
require.Positive(t, stats.DroppedSamples)
|
||||
|
||||
// Only the new checkpoint should be left.
|
||||
files, err := os.ReadDir(dir)
|
||||
|
|
|
@ -2973,8 +2973,10 @@ func assertAPIError(t *testing.T, got *apiError, exp errorType) {
|
|||
t.Helper()
|
||||
|
||||
if exp == errorNone {
|
||||
//nolint:testifylint
|
||||
require.Nil(t, got)
|
||||
} else {
|
||||
//nolint:testifylint
|
||||
require.NotNil(t, got)
|
||||
require.Equal(t, exp, got.typ, "(%q)", got)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue