Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade go version to 1.21.0 #5618

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
lint:
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
test:
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand All @@ -59,7 +59,7 @@ jobs:
build:
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
- name: Upgrade golang
uses: actions/setup-go@v2
with:
go-version: 1.20.1
go-version: 1.21.0
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Docker Client
Expand Down Expand Up @@ -193,14 +193,14 @@ jobs:
run: |
touch build-image/.uptodate
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5 TTY='' configs-integration-test
make BUILD_IMAGE=quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b TTY='' configs-integration-test

deploy_website:
needs: [build, test]
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -242,7 +242,7 @@ jobs:
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
runs-on: ubuntu-20.04
container:
image: quay.io/cortexproject/build-image:upgrade-to-go-1.20.4-6025f83e5
image: quay.io/cortexproject/build-image:feature-master-update-to-go-1.21-050c36e7b
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ build-image/$(UPTODATE): build-image/*
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
BUILD_IN_CONTAINER := true
BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image
LATEST_BUILD_IMAGE_TAG ?= upgrade-to-go-1.20.4-6025f83e5
LATEST_BUILD_IMAGE_TAG ?= feature-master-update-to-go-1.21-050c36e7b

# TTY is parameterized to allow Google Cloud Builder to run builds,
# as it currently disallows TTY devices. This value needs to be overridden
Expand Down
2 changes: 1 addition & 1 deletion build-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.4-bullseye
FROM golang:1.21.0-bullseye
ARG goproxyValue
ENV GOPROXY=${goproxyValue}
RUN apt-get update && apt-get install -y curl file jq unzip protobuf-compiler libprotobuf-dev && \
Expand Down
2 changes: 1 addition & 1 deletion cmd/cortex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func main() {
}

// Initialise seed for randomness usage.
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))

t, err := cortex.New(cfg)
util_log.CheckFatal("initializing cortex", err)
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/cortexproject/cortex

go 1.18
go 1.21

require (
github.com/Masterminds/squirrel v1.5.4
Expand Down
77 changes: 77 additions & 0 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/ring/ring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ func TestRing_ShuffleShardWithLookback_CorrectnessWithFuzzy(t *testing.T) {
t.Run(testName, func(t *testing.T) {
// Randomise the seed but log it in case we need to reproduce the test on failure.
seed := time.Now().UnixNano()
rand.Seed(seed)
rand.New(rand.NewSource(seed))
t.Log("random generator seed:", seed)

// Initialise the ring.
Expand Down
4 changes: 2 additions & 2 deletions pkg/storegateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func TestStoreGateway_InitialSyncWithWaitRingStability(t *testing.T) {
//parallel testing causes data race
// Randomise the seed but log it in case we need to reproduce the test on failure.
seed := time.Now().UnixNano()
rand.Seed(seed)
rand.New(rand.NewSource(seed))
t.Log("random generator seed:", seed)

ctx := context.Background()
Expand Down Expand Up @@ -419,7 +419,7 @@ func TestStoreGateway_BlocksSyncWithDefaultSharding_RingTopologyChangedAfterScal

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

ctx := context.Background()
Expand Down
3 changes: 1 addition & 2 deletions pkg/util/grpcencoding/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package grpcencoding
import (
"bytes"
"io"
"io/ioutil"
"strings"
"testing"

Expand Down Expand Up @@ -173,6 +172,6 @@ func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize
}
// Read from LimitReader with limit max+1. So if the underlying
// reader is over limit, the result will be bigger than max.
d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
d, err = io.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
return d, len(d), err
}
2 changes: 1 addition & 1 deletion pkg/util/metrics_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func TestFloat64PrecisionStability(t *testing.T) {

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

// Generate a large number of registries with different metrics each.
Expand Down
12 changes: 7 additions & 5 deletions pkg/util/tls/test/tls_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,11 @@ func TestTLSServerWithLocalhostCertWithClientCertificateEnforcementUsingClientCA
cfg.GRPCTLSConfig.ClientAuth = "RequireAndVerifyClientCert"

// TODO: Investigate why we don't really receive the error about the
// bad certificate from the server side and just see connection
// certificate required from the server side and just see connection
// closed/reset instead
badCertErr := errorContainsString("remote error: tls: bad certificate")
// In Go 1.21, TLS 1.3 would return certificate required error instead
// of bad certificate error
certRequiredErr := errorContainsString("remote error: tls: certificate required")
newIntegrationClientServer(
t,
cfg,
Expand All @@ -358,7 +360,7 @@ func TestTLSServerWithLocalhostCertWithClientCertificateEnforcementUsingClientCA
tlsConfig: tls.ClientConfig{
InsecureSkipVerify: true,
},
httpExpectError: badCertErr,
httpExpectError: certRequiredErr,
grpcExpectError: unavailableDescErr,
},
{
Expand All @@ -367,7 +369,7 @@ func TestTLSServerWithLocalhostCertWithClientCertificateEnforcementUsingClientCA
tlsConfig: tls.ClientConfig{
CAPath: certs.caCertFile,
},
httpExpectError: badCertErr,
httpExpectError: certRequiredErr,
grpcExpectError: unavailableDescErr,
},
{
Expand Down Expand Up @@ -396,7 +398,7 @@ func TestTLSServerWithLocalhostCertWithClientCertificateEnforcementUsingClientCA
CertPath: certs.client2CertFile,
KeyPath: certs.client2KeyFile,
},
httpExpectError: badCertErr,
httpExpectError: certRequiredErr,
grpcExpectError: unavailableDescErr,
},
},
Expand Down
Loading