Skip to content

Commit

Permalink
Bump expected Go version to 1.22 (#9134)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
narqo authored Aug 30, 2024
1 parent 6d2494b commit 3699327
Show file tree
Hide file tree
Showing 85 changed files with 13 additions and 818 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Grafana Mimir

* [CHANGE] Update minimal supported version of Go to 1.22. #9134
* [CHANGE] Store-gateway / querier: enable streaming chunks from store-gateways to queriers by default. #6646
* [CHANGE] Querier: honor the start/end time range specified in the read hints when executing a remote read request. #8431
* [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
Expand Down
22 changes: 10 additions & 12 deletions cmd/mimir/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,11 @@ func TestExpandEnvironmentVariables(t *testing.T) {
}`},
}

for _, test := range tests {
test := test
t.Run(test.in, func(t *testing.T) {
_ = os.Setenv("y", test.env)
output := expandEnvironmentVariables([]byte(test.in))
assert.Equal(t, test.out, string(output), "Input: %s", test.in)
for _, tt := range tests {
t.Run(tt.in, func(t *testing.T) {
_ = os.Setenv("y", tt.env)
output := expandEnvironmentVariables([]byte(tt.in))
assert.Equal(t, tt.out, string(output), "Input: %s", tt.in)
})
}
}
Expand Down Expand Up @@ -482,13 +481,12 @@ func TestParseConfigFileParameter(t *testing.T) {
{"--config.file=foo --opt1 --config.expand-env", "foo", true},
{"--config.expand-env --opt1 --config.file=foo", "foo", true},
}
for _, test := range tests {
test := test
t.Run(test.args, func(t *testing.T) {
args := strings.Split(test.args, " ")
for _, tt := range tests {
t.Run(tt.args, func(t *testing.T) {
args := strings.Split(tt.args, " ")
configFile, expandEnv := parseConfigFileParameter(args)
assert.Equal(t, test.configFile, configFile)
assert.Equal(t, test.expandEnv, expandEnv)
assert.Equal(t, tt.configFile, configFile)
assert.Equal(t, tt.expandEnv, expandEnv)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/grafana/mimir

go 1.21.0
go 1.22

// Please note that this directive is ignored when building with the Mimir build image,
// that will always use its bundled toolchain.
Expand Down
3 changes: 1 addition & 2 deletions integration/distributor_high_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ func testDistributorHighConcurrency(t *testing.T, cachingUnmarshalDataEnabled bo
step := timeRange / samples

wg := sync.WaitGroup{}
for i := 0; i < writers; i++ {
i := i
for i := range writers {
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
2 changes: 0 additions & 2 deletions pkg/alertmanager/alertmanager_ring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ func TestIsHealthyForAlertmanagerOperations(t *testing.T) {
}

for testName, testData := range tests {
testData := testData

t.Run(testName, func(t *testing.T) {
actual := testData.instance.IsHealthy(RingOp, testData.timeout, time.Now())
assert.Equal(t, testData.expected, actual)
Expand Down
4 changes: 0 additions & 4 deletions pkg/alertmanager/multitenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,6 @@ receivers:

for receiverName, testData := range tests {
for _, firewallEnabled := range []bool{true, false} {
receiverName := receiverName
testData := testData
firewallEnabled := firewallEnabled

t.Run(fmt.Sprintf("receiver=%s firewall enabled=%v", receiverName, firewallEnabled), func(t *testing.T) {
t.Parallel()

Expand Down
4 changes: 0 additions & 4 deletions pkg/blockbuilder/tsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ func (b *TSDBBuilder) CompactAndUpload(ctx context.Context, uploadBlocks blockUp
eg.SetLimit(b.config.TSDB.ShipConcurrency)
}
for tenant, db := range b.tsdbs {
// Change scope of for loop variables.
tenant := tenant
db := db

eg.Go(func() error {
// TODO(codesome): add a metric for compaction and upload failures. An alert on this will be useful.
if err := db.compactEverything(ctx); err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/compactor/block_upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,6 @@ func TestMultitenantCompactor_PeriodicValidationUpdater(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {

bkt := objstore.NewInMemBucket()
var injectedBkt objstore.Bucket = bkt
if tc.errorInjector != nil {
Expand Down
2 changes: 0 additions & 2 deletions pkg/compactor/blocks_cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ func TestBlocksCleaner(t *testing.T) {
{concurrency: 2},
{concurrency: 10},
} {
options := options

t.Run(options.String(), func(t *testing.T) {
t.Parallel()
testBlocksCleanerWithOptions(t, options)
Expand Down
1 change: 0 additions & 1 deletion pkg/compactor/bucket_compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ func TestCompactedBlocksTimeRangeVerification(t *testing.T) {
}

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

Expand Down
1 change: 0 additions & 1 deletion pkg/compactor/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,6 @@ func TestOwnUser(t *testing.T) {
}

for name, tc := range testCases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion pkg/continuoustest/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ var (

func init() {
for i, histProfile := range histogramProfiles {
histProfile := histProfile // shadowing it to ensure it's properly updated in the closure
histogramProfiles[i].generateValue = nil
histogramProfiles[i].generateSeries = func(name string, t time.Time, numSeries int) []prompb.TimeSeries {
return generateHistogramSeriesInner(name, t, numSeries, histProfile.generateHistogram)
Expand Down
1 change: 0 additions & 1 deletion pkg/continuoustest/write_read_series_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func init() {

histTestTuples = make([]WriteReadSeriesTestTuple, len(histogramProfiles))
for i, histProfile := range histogramProfiles {
i := i // shadowing it to ensure it's properly updated in the closure
histTestTuples[i] = WriteReadSeriesTestTuple{
metricName: histProfile.metricName,
typeLabel: histProfile.typeLabel,
Expand Down
16 changes: 0 additions & 16 deletions pkg/distributor/distributor_ingest_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ func TestDistributor_Push_ShouldSupportIngestStorage(t *testing.T) {
}

for testName, testData := range tests {
testData := testData

t.Run(testName, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -368,8 +366,6 @@ func TestDistributor_Push_ShouldSupportWriteBothToIngestersAndPartitions(t *test
}

for testName, testData := range tests {
testData := testData

t.Run(testName, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -848,14 +844,10 @@ func TestDistributor_UserStats_ShouldSupportIngestStorage(t *testing.T) {
}

for testName, testData := range tests {
testData := testData

t.Run(testName, func(t *testing.T) {
t.Parallel()

for _, minimizeIngesterRequests := range []bool{false, true} {
minimizeIngesterRequests := minimizeIngesterRequests

t.Run(fmt.Sprintf("minimize ingester requests: %t", minimizeIngesterRequests), func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1150,14 +1142,10 @@ func TestDistributor_LabelValuesCardinality_AvailabilityAndConsistencyWithIngest
}

for testName, testData := range tests {
testData := testData

t.Run(testName, func(t *testing.T) {
t.Parallel()

for _, minimizeIngesterRequests := range []bool{false, true} {
minimizeIngesterRequests := minimizeIngesterRequests

t.Run(fmt.Sprintf("minimize ingester requests: %t", minimizeIngesterRequests), func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1443,14 +1431,10 @@ func TestDistributor_ActiveSeries_AvailabilityAndConsistencyWithIngestStorage(t
}

for testName, testData := range tests {
testData := testData

t.Run(testName, func(t *testing.T) {
t.Parallel()

for _, minimizeIngesterRequests := range []bool{false, true} {
minimizeIngesterRequests := minimizeIngesterRequests

t.Run(fmt.Sprintf("minimize ingester requests: %t", minimizeIngesterRequests), func(t *testing.T) {
t.Parallel()

Expand Down
Loading

0 comments on commit 3699327

Please sign in to comment.