From 069ceeaefba07457c9e23e6e601ba285c748b994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Sun, 8 Jan 2023 17:10:18 +0100 Subject: [PATCH] Fix linter errors after linter update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated linter golangci-lint from 1.45 to 1.50 previously Signed-off-by: György Krajcsovits --- tsdb/async_block_writer.go | 4 ++-- tsdb/index/postings.go | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tsdb/async_block_writer.go b/tsdb/async_block_writer.go index 0d5449a5f9..7747a52cb5 100644 --- a/tsdb/async_block_writer.go +++ b/tsdb/async_block_writer.go @@ -151,7 +151,7 @@ func newPreventDoubleCloseIndexWriter(iw IndexWriter) *preventDoubleCloseIndexWr } func (p *preventDoubleCloseIndexWriter) Close() error { - if p.closed.CAS(false, true) { + if p.closed.CompareAndSwap(false, true) { return p.IndexWriter.Close() } return nil @@ -167,7 +167,7 @@ func newPreventDoubleCloseChunkWriter(cw ChunkWriter) *preventDoubleCloseChunkWr } func (p *preventDoubleCloseChunkWriter) Close() error { - if p.closed.CAS(false, true) { + if p.closed.CompareAndSwap(false, true) { return p.ChunkWriter.Close() } return nil diff --git a/tsdb/index/postings.go b/tsdb/index/postings.go index abfb10db15..1006aefa7e 100644 --- a/tsdb/index/postings.go +++ b/tsdb/index/postings.go @@ -858,13 +858,6 @@ func (c *PostingsCloner) Clone() Postings { return newListPostings(c.ids...) } -// seriesRefSlice attaches the methods of sort.Interface to []storage.SeriesRef, sorting in increasing order. -type seriesRefSlice []storage.SeriesRef - -func (x seriesRefSlice) Len() int { return len(x) } -func (x seriesRefSlice) Less(i, j int) bool { return x[i] < x[j] } -func (x seriesRefSlice) Swap(i, j int) { x[i], x[j] = x[j], x[i] } - // FindIntersectingPostings checks the intersection of p and candidates[i] for each i in candidates, // if intersection is non empty, then i is added to the indexes returned. // Returned indexes are not sorted.