Skip to content

Commit 5c0c9ce

Browse files
committed
Lint
1 parent fcef75b commit 5c0c9ce

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

pkg/ingester/active_series.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ func (s *activeSeriesStripe) updateSeriesTimestamp(now time.Time, series labels.
113113

114114
if !entryTimeSet {
115115
if prev := e.Load(); nowNanos > prev {
116-
entryTimeSet = e.CAS(prev, nowNanos)
116+
entryTimeSet = e.CompareAndSwap(prev, nowNanos)
117117
}
118118
}
119119

120120
if entryTimeSet {
121121
for prevOldest := s.oldestEntryTs.Load(); nowNanos < prevOldest; {
122122
// If recent purge already removed entries older than "oldest entry timestamp", setting this to 0 will make
123123
// sure that next purge doesn't take the shortcut route.
124-
if s.oldestEntryTs.CAS(prevOldest, 0) {
124+
if s.oldestEntryTs.CompareAndSwap(prevOldest, 0) {
125125
break
126126
}
127127
}

pkg/ingester/active_series_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ func TestActiveSeries_Purge(t *testing.T) {
6060

6161
func TestActiveSeries_PurgeOpt(t *testing.T) {
6262
metric := labels.NewBuilder(labels.FromStrings("__name__", "logs"))
63-
ls1 := metric.Set("_", "ypfajYg2lsv").Labels()
64-
ls2 := metric.Set("_", "KiqbryhzUpn").Labels()
63+
ls1 := metric.Set("_", "ypfajYg2lsv").Labels(nil)
64+
ls2 := metric.Set("_", "KiqbryhzUpn").Labels(nil)
6565

6666
c := NewActiveSeries()
6767

pkg/querier/querier_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func mockTSDB(t *testing.T, labels []labels.Labels, mint model.Time, samples int
336336
opts := tsdb.DefaultHeadOptions()
337337
opts.ChunkDirRoot = t.TempDir()
338338
// We use TSDB head only. By using full TSDB DB, and appending samples to it, closing it would cause unnecessary HEAD compaction, which slows down the test.
339-
head, err := tsdb.NewHead(nil, nil, nil, opts, nil)
339+
head, err := tsdb.NewHead(nil, nil, nil, nil, opts, nil)
340340
require.NoError(t, err)
341341
t.Cleanup(func() {
342342
_ = head.Close()

pkg/storegateway/bucket_stores_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ type failFirstGetBucket struct {
582582
}
583583

584584
func (f *failFirstGetBucket) Get(ctx context.Context, name string) (io.ReadCloser, error) {
585-
if f.firstGet.CAS(false, true) {
585+
if f.firstGet.CompareAndSwap(false, true) {
586586
return nil, errors.New("Get() request mocked error")
587587
}
588588

pkg/util/concurrency/runner_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestForEachUser_ShouldContinueOnErrorButReturnIt(t *testing.T) {
4545
input := []string{"a", "b", "c"}
4646

4747
err := ForEachUser(ctx, input, 2, func(ctx context.Context, user string) error {
48-
if processed.CAS(0, 1) {
48+
if processed.CompareAndSwap(0, 1) {
4949
return errors.New("the first request is failing")
5050
}
5151

@@ -103,7 +103,7 @@ func TestForEach_ShouldBreakOnFirstError_ContextCancellationHandled(t *testing.T
103103
)
104104

105105
err := ForEach(ctx, []interface{}{"a", "b", "c"}, 2, func(ctx context.Context, job interface{}) error {
106-
if processed.CAS(0, 1) {
106+
if processed.CompareAndSwap(0, 1) {
107107
return errors.New("the first request is failing")
108108
}
109109

@@ -140,7 +140,7 @@ func TestForEach_ShouldBreakOnFirstError_ContextCancellationUnhandled(t *testing
140140
err := ForEach(ctx, []interface{}{"a", "b", "c"}, 2, func(ctx context.Context, job interface{}) error {
141141
wg.Done()
142142

143-
if processed.CAS(0, 1) {
143+
if processed.CompareAndSwap(0, 1) {
144144
// wait till two jobs have been started
145145
wg.Wait()
146146
return errors.New("the first request is failing")

0 commit comments

Comments
 (0)