Skip to content

Commit 8505ac4

Browse files
authored
Upgrade go version to 1.21.0 (#5618)
* Upgrade go version to 1.21.0 Signed-off-by: Alex Le <leqiyue@amazon.com> * fix lint Signed-off-by: Alex Le <leqiyue@amazon.com> * fix lint Signed-off-by: Alex Le <leqiyue@amazon.com> * fix tls test Signed-off-by: Alex Le <leqiyue@amazon.com> --------- Signed-off-by: Alex Le <leqiyue@amazon.com>
1 parent 1d2e2ee commit 8505ac4

File tree

11 files changed

+100
-22
lines changed

11 files changed

+100
-22
lines changed

.github/workflows/test-build-deploy.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
lint:
1212
runs-on: ubuntu-20.04
1313
container:
14-
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
14+
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
1515
steps:
1616
- name: Checkout Repo
1717
uses: actions/checkout@v2
@@ -40,7 +40,7 @@ jobs:
4040
test:
4141
runs-on: ubuntu-20.04
4242
container:
43-
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
43+
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
4444
steps:
4545
- name: Checkout Repo
4646
uses: actions/checkout@v2
@@ -59,7 +59,7 @@ jobs:
5959
build:
6060
runs-on: ubuntu-20.04
6161
container:
62-
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
62+
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
6363
steps:
6464
- name: Checkout Repo
6565
uses: actions/checkout@v2
@@ -118,7 +118,7 @@ jobs:
118118
- name: Upgrade golang
119119
uses: actions/setup-go@v2
120120
with:
121-
go-version: 1.20.1
121+
go-version: 1.21.0
122122
- name: Checkout Repo
123123
uses: actions/checkout@v2
124124
- name: Install Docker Client
@@ -193,14 +193,14 @@ jobs:
193193
run: |
194194
touch build-image/.uptodate
195195
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
196-
make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5 TTY='' configs-integration-test
196+
make BUILD_IMAGE=quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b TTY='' configs-integration-test
197197
198198
deploy_website:
199199
needs: [build, test]
200200
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
201201
runs-on: ubuntu-20.04
202202
container:
203-
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
203+
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
204204
steps:
205205
- name: Checkout Repo
206206
uses: actions/checkout@v2
@@ -242,7 +242,7 @@ jobs:
242242
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
243243
runs-on: ubuntu-20.04
244244
container:
245-
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
245+
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
246246
steps:
247247
- name: Checkout Repo
248248
uses: actions/checkout@v2

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ build-image/$(UPTODATE): build-image/*
122122
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
123123
BUILD_IN_CONTAINER := true
124124
BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image
125-
LATEST_BUILD_IMAGE_TAG ?= upgrade-to-go-1.20.4-6025f83e5
125+
LATEST_BUILD_IMAGE_TAG ?= feature-master-update-to-go-1.21-050c36e7b
126126

127127
# TTY is parameterized to allow Google Cloud Builder to run builds,
128128
# as it currently disallows TTY devices. This value needs to be overridden

build-image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20.4-bullseye
1+
FROM golang:1.21.0-bullseye
22
ARG goproxyValue
33
ENV GOPROXY=${goproxyValue}
44
RUN apt-get update && apt-get install -y curl file jq unzip protobuf-compiler libprotobuf-dev && \

cmd/cortex/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func main() {
174174
}
175175

176176
// Initialise seed for randomness usage.
177-
rand.Seed(time.Now().UnixNano())
177+
rand.New(rand.NewSource(time.Now().UnixNano()))
178178

179179
t, err := cortex.New(cfg)
180180
util_log.CheckFatal("initializing cortex", err)

go.mod

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

3-
go 1.18
3+
go 1.21
44

55
require (
66
github.com/Masterminds/squirrel v1.5.4

go.sum

Lines changed: 77 additions & 0 deletions
Large diffs are not rendered by default.

pkg/ring/ring_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2406,7 +2406,7 @@ func TestRing_ShuffleShardWithLookback_CorrectnessWithFuzzy(t *testing.T) {
24062406
t.Run(testName, func(t *testing.T) {
24072407
// Randomise the seed but log it in case we need to reproduce the test on failure.
24082408
seed := time.Now().UnixNano()
2409-
rand.Seed(seed)
2409+
rand.New(rand.NewSource(seed))
24102410
t.Log("random generator seed:", seed)
24112411

24122412
// Initialise the ring.

pkg/storegateway/gateway_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func TestStoreGateway_InitialSyncWithWaitRingStability(t *testing.T) {
314314
//parallel testing causes data race
315315
// Randomise the seed but log it in case we need to reproduce the test on failure.
316316
seed := time.Now().UnixNano()
317-
rand.Seed(seed)
317+
rand.New(rand.NewSource(seed))
318318
t.Log("random generator seed:", seed)
319319

320320
ctx := context.Background()
@@ -419,7 +419,7 @@ func TestStoreGateway_BlocksSyncWithDefaultSharding_RingTopologyChangedAfterScal
419419

420420
// Randomise the seed but log it in case we need to reproduce the test on failure.
421421
seed := time.Now().UnixNano()
422-
rand.Seed(seed)
422+
rand.New(rand.NewSource(seed))
423423
t.Log("random generator seed:", seed)
424424

425425
ctx := context.Background()

pkg/util/grpcencoding/encoding_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package grpcencoding
33
import (
44
"bytes"
55
"io"
6-
"io/ioutil"
76
"strings"
87
"testing"
98

@@ -173,6 +172,6 @@ func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize
173172
}
174173
// Read from LimitReader with limit max+1. So if the underlying
175174
// reader is over limit, the result will be bigger than max.
176-
d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
175+
d, err = io.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
177176
return d, len(d), err
178177
}

pkg/util/metrics_helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ func TestFloat64PrecisionStability(t *testing.T) {
461461

462462
// Randomise the seed but log it in case we need to reproduce the test on failure.
463463
seed := time.Now().UnixNano()
464-
rand.Seed(seed)
464+
rand.New(rand.NewSource(seed))
465465
t.Log("random generator seed:", seed)
466466

467467
// Generate a large number of registries with different metrics each.

0 commit comments

Comments
 (0)