Skip to content

Commit 0be2dd5

Browse files
Guangming Wangcsmarchbanks
authored andcommitted
code cleanup following staticcheck (#1701)
Signed-off-by: Guangming Wang <[email protected]>
1 parent bf9aa2e commit 0be2dd5

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

pkg/chunk/inmemory_storage_client.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ func (m *MockStorage) query(ctx context.Context, query IndexQuery, callback func
266266
}
267267

268268
result := mockReadBatch{}
269-
for _, item := range items {
270-
result.items = append(result.items, item)
271-
}
269+
result.items = append(result.items, items...)
272270

273271
callback(&result)
274272
return nil

pkg/chunk/storage/caching_index_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ func (s *cachingIndexClient) cacheStore(ctx context.Context, keys []string, batc
233233
}
234234

235235
s.cache.Store(ctx, hashed, bufs)
236-
return
237236
}
238237

239238
func (s *cachingIndexClient) cacheFetch(ctx context.Context, keys []string) (batches []ReadBatch, missed []string) {

pkg/chunk/table_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (m *TableManager) Start() {
152152
m.wait.Add(1)
153153
go m.loop()
154154

155-
if m.bucketClient != nil && m.cfg.RetentionPeriod != 0 && m.cfg.RetentionDeletesEnabled == true {
155+
if m.bucketClient != nil && m.cfg.RetentionPeriod != 0 && m.cfg.RetentionDeletesEnabled {
156156
m.wait.Add(1)
157157
go m.bucketRetentionLoop()
158158
}

pkg/ingester/ingester.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,7 @@ func (i *Ingester) LabelValues(ctx old_ctx.Context, req *client.LabelValuesReque
489489
}
490490

491491
resp := &client.LabelValuesResponse{}
492-
for _, v := range state.index.LabelValues(req.LabelName) {
493-
resp.LabelValues = append(resp.LabelValues, v)
494-
}
492+
resp.LabelValues = append(resp.LabelValues, state.index.LabelValues(req.LabelName)...)
495493

496494
return resp, nil
497495
}
@@ -508,9 +506,7 @@ func (i *Ingester) LabelNames(ctx old_ctx.Context, req *client.LabelNamesRequest
508506
}
509507

510508
resp := &client.LabelNamesResponse{}
511-
for _, v := range state.index.LabelNames() {
512-
resp.LabelNames = append(resp.LabelNames, v)
513-
}
509+
resp.LabelNames = append(resp.LabelNames, state.index.LabelNames()...)
514510

515511
return resp, nil
516512
}

pkg/querier/correctness/simple.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ func (tc *simpleTestCase) Query(ctx context.Context, client v1.API, selectors st
7878
return nil, fmt.Errorf("didn't get matrix from Prom")
7979
}
8080

81-
result := []model.SamplePair{}
81+
var result []model.SamplePair
8282
for _, stream := range ms {
83-
for _, pair := range stream.Values {
84-
result = append(result, pair)
85-
}
83+
result = append(result, stream.Values...)
8684
}
8785
return result, nil
8886
}

0 commit comments

Comments
 (0)