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:<linter>,<linter>,...'
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 <marcelo.magallon@grafana.com>
This commit is contained in:
Marcelo E. Magallon 2021-02-04 05:57:16 -06:00
parent 7db09551b0
commit 75d86c6747
4 changed files with 11 additions and 11 deletions

View File

@ -83,7 +83,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
GOLANGCI_LINT := GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?= 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. # golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# 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))

View File

@ -1571,7 +1571,7 @@ func getPointSlice(sz int) []Point {
} }
func putPointSlice(p []Point) { func putPointSlice(p []Point) {
//lint:ignore SA6002 relax staticcheck verification. //nolint:staticcheck // Ignore SA6002 relax staticcheck verification.
pointPool.Put(p[:0]) pointPool.Put(p[:0])
} }

View File

@ -551,7 +551,7 @@ Outer:
h.lastSeriesID.Store(s.Ref) h.lastSeriesID.Store(s.Ref)
} }
} }
//lint:ignore SA6002 relax staticcheck verification. //nolint:staticcheck // Ignore SA6002 relax staticcheck verification.
seriesPool.Put(v) seriesPool.Put(v)
case []record.RefSample: case []record.RefSample:
samples := v samples := v
@ -584,7 +584,7 @@ Outer:
} }
samples = samples[m:] samples = samples[m:]
} }
//lint:ignore SA6002 relax staticcheck verification. //nolint:staticcheck // Ignore SA6002 relax staticcheck verification.
samplesPool.Put(v) samplesPool.Put(v)
case []tombstones.Stone: case []tombstones.Stone:
for _, s := range v { for _, s := range v {
@ -599,7 +599,7 @@ Outer:
h.tombstones.AddInterval(s.Ref, itv) h.tombstones.AddInterval(s.Ref, itv)
} }
} }
//lint:ignore SA6002 relax staticcheck verification. //nolint:staticcheck // Ignore SA6002 relax staticcheck verification.
tstonesPool.Put(v) tstonesPool.Put(v)
default: default:
panic(fmt.Errorf("unexpected decoded type: %T", d)) 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) { 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]) h.appendPool.Put(b[:0])
} }
@ -1120,7 +1120,7 @@ func (h *Head) getSeriesBuffer() []*memSeries {
} }
func (h *Head) putSeriesBuffer(b []*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]) h.seriesPool.Put(b[:0])
} }
@ -1133,7 +1133,7 @@ func (h *Head) getBytesBuffer() []byte {
} }
func (h *Head) putBytesBuffer(b []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]) h.bytesPool.Put(b[:0])
} }

View File

@ -890,19 +890,19 @@ func (r *walReader) Read(
if seriesf != nil { if seriesf != nil {
seriesf(v) 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]) seriesPool.Put(v[:0])
case []record.RefSample: case []record.RefSample:
if samplesf != nil { if samplesf != nil {
samplesf(v) 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]) samplePool.Put(v[:0])
case []tombstones.Stone: case []tombstones.Stone:
if deletesf != nil { if deletesf != nil {
deletesf(v) 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]) deletePool.Put(v[:0])
default: default:
level.Error(r.logger).Log("msg", "unexpected data type") level.Error(r.logger).Log("msg", "unexpected data type")