From 75d86c6747deae06e29748e3921b8b0cf70d5e44 Mon Sep 17 00:00:00 2001 From: "Marcelo E. Magallon" Date: Thu, 4 Feb 2021 05:57:16 -0600 Subject: [PATCH] Update golangci-lint to 1.36.0 In the previous version, 1.18.0, the "megacheck" linter paid attention to the '//lint:ignore' comment, but that is no longer there. Newer version pay attention to '//nolint:,,...' comments, optionally followed by a "second" comment introduced by '//'. Update the directives to use this style. This is related to prometheus/blackbox_exporter#738 and prometheus/blackbox_exporter#745. Signed-off-by: Marcelo E. Magallon --- Makefile.common | 2 +- promql/engine.go | 2 +- tsdb/head.go | 12 ++++++------ tsdb/wal.go | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile.common b/Makefile.common index 3ac29c636..2b73d86a6 100644 --- a/Makefile.common +++ b/Makefile.common @@ -83,7 +83,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.18.0 +GOLANGCI_LINT_VERSION ?= v1.36.0 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) diff --git a/promql/engine.go b/promql/engine.go index 2a90b4805..dfd21a6db 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -1571,7 +1571,7 @@ func getPointSlice(sz int) []Point { } func putPointSlice(p []Point) { - //lint:ignore SA6002 relax staticcheck verification. + //nolint:staticcheck // Ignore SA6002 relax staticcheck verification. pointPool.Put(p[:0]) } diff --git a/tsdb/head.go b/tsdb/head.go index bf54511a8..d968caa28 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -551,7 +551,7 @@ Outer: h.lastSeriesID.Store(s.Ref) } } - //lint:ignore SA6002 relax staticcheck verification. + //nolint:staticcheck // Ignore SA6002 relax staticcheck verification. seriesPool.Put(v) case []record.RefSample: samples := v @@ -584,7 +584,7 @@ Outer: } samples = samples[m:] } - //lint:ignore SA6002 relax staticcheck verification. + //nolint:staticcheck // Ignore SA6002 relax staticcheck verification. samplesPool.Put(v) case []tombstones.Stone: for _, s := range v { @@ -599,7 +599,7 @@ Outer: h.tombstones.AddInterval(s.Ref, itv) } } - //lint:ignore SA6002 relax staticcheck verification. + //nolint:staticcheck // Ignore SA6002 relax staticcheck verification. tstonesPool.Put(v) default: panic(fmt.Errorf("unexpected decoded type: %T", d)) @@ -1107,7 +1107,7 @@ func (h *Head) getAppendBuffer() []record.RefSample { } func (h *Head) putAppendBuffer(b []record.RefSample) { - //lint:ignore SA6002 safe to ignore and actually fixing it has some performance penalty. + //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. h.appendPool.Put(b[:0]) } @@ -1120,7 +1120,7 @@ func (h *Head) getSeriesBuffer() []*memSeries { } func (h *Head) putSeriesBuffer(b []*memSeries) { - //lint:ignore SA6002 safe to ignore and actually fixing it has some performance penalty. + //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. h.seriesPool.Put(b[:0]) } @@ -1133,7 +1133,7 @@ func (h *Head) getBytesBuffer() []byte { } func (h *Head) putBytesBuffer(b []byte) { - //lint:ignore SA6002 safe to ignore and actually fixing it has some performance penalty. + //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. h.bytesPool.Put(b[:0]) } diff --git a/tsdb/wal.go b/tsdb/wal.go index 7856ac14c..8d49c8432 100644 --- a/tsdb/wal.go +++ b/tsdb/wal.go @@ -890,19 +890,19 @@ func (r *walReader) Read( if seriesf != nil { seriesf(v) } - //lint:ignore SA6002 safe to ignore and actually fixing it has some performance penalty. + //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. seriesPool.Put(v[:0]) case []record.RefSample: if samplesf != nil { samplesf(v) } - //lint:ignore SA6002 safe to ignore and actually fixing it has some performance penalty. + //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. samplePool.Put(v[:0]) case []tombstones.Stone: if deletesf != nil { deletesf(v) } - //lint:ignore SA6002 safe to ignore and actually fixing it has some performance penalty. + //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. deletePool.Put(v[:0]) default: level.Error(r.logger).Log("msg", "unexpected data type")