Skip to content

Commit 3699327

Browse files
authored
Bump expected Go version to 1.22 (#9134)
* bump go to 1.22 Signed-off-by: Vladimir Varankin <[email protected]> * go mod vendor Signed-off-by: Vladimir Varankin <[email protected]> * cmd/mimir: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/alertmanager: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/blockbuilder: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/compactor: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/continuoustest: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/distributor: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/frontend/querymiddleware: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/ingester: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/querier: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/ruler: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * pkg/storage,pkg/storegateway: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * integration: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * all: fix loopvar Signed-off-by: Vladimir Varankin <[email protected]> * add changelog Signed-off-by: Vladimir Varankin <[email protected]> --------- Signed-off-by: Vladimir Varankin <[email protected]>
1 parent 6d2494b commit 3699327

File tree

85 files changed

+13
-818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+13
-818
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Grafana Mimir
66

7+
* [CHANGE] Update minimal supported version of Go to 1.22. #9134
78
* [CHANGE] Store-gateway / querier: enable streaming chunks from store-gateways to queriers by default. #6646
89
* [CHANGE] Querier: honor the start/end time range specified in the read hints when executing a remote read request. #8431
910
* [CHANGE] Querier: return only samples within the queried start/end time range when executing a remote read request using "SAMPLES" mode. Previously, samples outside of the range could have been returned. Samples outside of the queried time range may still be returned when executing a remote read request using "STREAMED_XOR_CHUNKS" mode. #8463

cmd/mimir/main_test.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,11 @@ func TestExpandEnvironmentVariables(t *testing.T) {
398398
}`},
399399
}
400400

401-
for _, test := range tests {
402-
test := test
403-
t.Run(test.in, func(t *testing.T) {
404-
_ = os.Setenv("y", test.env)
405-
output := expandEnvironmentVariables([]byte(test.in))
406-
assert.Equal(t, test.out, string(output), "Input: %s", test.in)
401+
for _, tt := range tests {
402+
t.Run(tt.in, func(t *testing.T) {
403+
_ = os.Setenv("y", tt.env)
404+
output := expandEnvironmentVariables([]byte(tt.in))
405+
assert.Equal(t, tt.out, string(output), "Input: %s", tt.in)
407406
})
408407
}
409408
}
@@ -482,13 +481,12 @@ func TestParseConfigFileParameter(t *testing.T) {
482481
{"--config.file=foo --opt1 --config.expand-env", "foo", true},
483482
{"--config.expand-env --opt1 --config.file=foo", "foo", true},
484483
}
485-
for _, test := range tests {
486-
test := test
487-
t.Run(test.args, func(t *testing.T) {
488-
args := strings.Split(test.args, " ")
484+
for _, tt := range tests {
485+
t.Run(tt.args, func(t *testing.T) {
486+
args := strings.Split(tt.args, " ")
489487
configFile, expandEnv := parseConfigFileParameter(args)
490-
assert.Equal(t, test.configFile, configFile)
491-
assert.Equal(t, test.expandEnv, expandEnv)
488+
assert.Equal(t, tt.configFile, configFile)
489+
assert.Equal(t, tt.expandEnv, expandEnv)
492490
})
493491
}
494492
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/grafana/mimir
22

3-
go 1.21.0
3+
go 1.22
44

55
// Please note that this directive is ignored when building with the Mimir build image,
66
// that will always use its bundled toolchain.

integration/distributor_high_concurrency_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ func testDistributorHighConcurrency(t *testing.T, cachingUnmarshalDataEnabled bo
9292
step := timeRange / samples
9393

9494
wg := sync.WaitGroup{}
95-
for i := 0; i < writers; i++ {
96-
i := i
95+
for i := range writers {
9796
wg.Add(1)
9897
go func() {
9998
defer wg.Done()

pkg/alertmanager/alertmanager_ring_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ func TestIsHealthyForAlertmanagerOperations(t *testing.T) {
4949
}
5050

5151
for testName, testData := range tests {
52-
testData := testData
53-
5452
t.Run(testName, func(t *testing.T) {
5553
actual := testData.instance.IsHealthy(RingOp, testData.timeout, time.Now())
5654
assert.Equal(t, testData.expected, actual)

pkg/alertmanager/multitenant_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,6 @@ receivers:
741741

742742
for receiverName, testData := range tests {
743743
for _, firewallEnabled := range []bool{true, false} {
744-
receiverName := receiverName
745-
testData := testData
746-
firewallEnabled := firewallEnabled
747-
748744
t.Run(fmt.Sprintf("receiver=%s firewall enabled=%v", receiverName, firewallEnabled), func(t *testing.T) {
749745
t.Parallel()
750746

pkg/blockbuilder/tsdb.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,6 @@ func (b *TSDBBuilder) CompactAndUpload(ctx context.Context, uploadBlocks blockUp
353353
eg.SetLimit(b.config.TSDB.ShipConcurrency)
354354
}
355355
for tenant, db := range b.tsdbs {
356-
// Change scope of for loop variables.
357-
tenant := tenant
358-
db := db
359-
360356
eg.Go(func() error {
361357
// TODO(codesome): add a metric for compaction and upload failures. An alert on this will be useful.
362358
if err := db.compactEverything(ctx); err != nil {

pkg/compactor/block_upload_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,6 @@ func TestMultitenantCompactor_PeriodicValidationUpdater(t *testing.T) {
17951795

17961796
for _, tc := range testCases {
17971797
t.Run(tc.name, func(t *testing.T) {
1798-
17991798
bkt := objstore.NewInMemBucket()
18001799
var injectedBkt objstore.Bucket = bkt
18011800
if tc.errorInjector != nil {

pkg/compactor/blocks_cleaner_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ func TestBlocksCleaner(t *testing.T) {
5959
{concurrency: 2},
6060
{concurrency: 10},
6161
} {
62-
options := options
63-
6462
t.Run(options.String(), func(t *testing.T) {
6563
t.Parallel()
6664
testBlocksCleanerWithOptions(t, options)

pkg/compactor/bucket_compactor_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ func TestCompactedBlocksTimeRangeVerification(t *testing.T) {
299299
}
300300

301301
for testName, testData := range tests {
302-
testData := testData // Prevent loop variable being captured by func literal
303302
t.Run(testName, func(t *testing.T) {
304303
t.Parallel()
305304

0 commit comments

Comments
 (0)