From 2908f13e0947d1bc99d443e2fda7e9279be63c8a Mon Sep 17 00:00:00 2001 From: Jack Francis Date: Mon, 24 Apr 2023 16:45:45 -0700 Subject: [PATCH] update golang to v1.20 --- .github/workflows/cover.yaml | 2 +- .github/workflows/dependabot-code-gen.yml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/scan.yml | 2 +- .golangci.yml | 6 +++--- Dockerfile | 2 +- Makefile | 4 ++-- Tiltfile | 2 +- .../machinepool_deployment_strategy.go | 5 +++-- docs/book/src/developers/development.md | 2 +- go.mod | 2 +- hack/ensure-go.sh | 2 +- hack/tools/go.mod | 2 +- 13 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cover.yaml b/.github/workflows/cover.yaml index fd30d3e3931..98c9392da1e 100644 --- a/.github/workflows/cover.yaml +++ b/.github/workflows/cover.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: '1.19' + go-version: '1.20' - run: "PATH=/usr/local/go/bin:$PATH make test-cover" - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/dependabot-code-gen.yml b/.github/workflows/dependabot-code-gen.yml index 3f81a8f79fc..5809175eb72 100644 --- a/.github/workflows/dependabot-code-gen.yml +++ b/.github/workflows/dependabot-code-gen.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v4 with: - go-version: '1.19' + go-version: '1.20' id: go - name: Check out code into the Go module directory uses: actions/checkout@v3 # tag=v3.2.0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 507f63b8188..b56f87478ad 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: - name: Install go uses: actions/setup-go@v4 with: - go-version: '^1.19' + go-version: '^1.20' - name: generate release artifacts run: | make release diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 884682c39c8..0c5974b587e 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -17,6 +17,6 @@ jobs: - name: Setup go uses: actions/setup-go@d0a58c1c4d2b25278816e339b944508c875f3613 # tag=v3.4.0 with: - go-version: 1.19 + go-version: 1.20 - name: Run verify container script run: make verify-container-images diff --git a/.golangci.yml b/.golangci.yml index fd3fb956563..9ca07cf78e4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -135,11 +135,11 @@ linters-settings: arguments: - disableStutteringCheck staticcheck: - go: "1.19" + go: "1.20" stylecheck: - go: "1.19" + go: "1.20" unused: - go: "1.19" + go: "1.20" issues: exclude-rules: diff --git a/Dockerfile b/Dockerfile index e9278d1169e..20d8cae12b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ARG ARCH # Build the manager binary -FROM golang:1.19 as builder +FROM golang:1.20 as builder WORKDIR /workspace # Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy diff --git a/Makefile b/Makefile index 47c399d706c..13fed0d4738 100644 --- a/Makefile +++ b/Makefile @@ -368,7 +368,7 @@ delete-workload-cluster: $(KUBECTL) ## Deletes the example workload Kubernetes c .PHONY: docker-pull-prerequisites docker-pull-prerequisites: ## Pull prerequisites for building controller-manager. docker pull docker/dockerfile:1.4 - docker pull docker.io/library/golang:1.19 + docker pull docker.io/library/golang:1.20 docker pull gcr.io/distroless/static:latest .PHONY: docker-build @@ -614,7 +614,7 @@ release-binary: $(RELEASE_DIR) ## Compile and build release binaries. -e GOARCH=$(GOARCH) \ -v "$$(pwd):/workspace" \ -w /workspace \ - golang:1.19 \ + golang:1.20 \ go build -a -ldflags '$(LDFLAGS) -extldflags "-static"' \ -o $(RELEASE_DIR)/$(notdir $(RELEASE_BINARY))-$(GOOS)-$(GOARCH) $(RELEASE_BINARY) diff --git a/Tiltfile b/Tiltfile index 4b228c3802b..fa6712d91d6 100644 --- a/Tiltfile +++ b/Tiltfile @@ -108,7 +108,7 @@ def validate_auth(): tilt_helper_dockerfile_header = """ # Tilt image -FROM golang:1.19 as tilt-helper +FROM golang:1.20 as tilt-helper # Support live reloading with Tilt RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/restart.sh && \ wget --output-document /start.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/start.sh && \ diff --git a/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go b/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go index c1e25ab020f..607d9bab9e1 100644 --- a/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go +++ b/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go @@ -290,8 +290,9 @@ func orderByOldest(machines []infrav1exp.AzureMachinePoolMachine) []infrav1exp.A } func orderRandom(machines []infrav1exp.AzureMachinePoolMachine) []infrav1exp.AzureMachinePoolMachine { - rand.Seed(time.Now().UnixNano()) - rand.Shuffle(len(machines), func(i, j int) { machines[i], machines[j] = machines[j], machines[i] }) + //nolint:gosec // We don't need a cryptographically appropriate random number here + r := rand.New(rand.NewSource(time.Now().UnixNano())) + r.Shuffle(len(machines), func(i, j int) { machines[i], machines[j] = machines[j], machines[i] }) return machines } diff --git a/docs/book/src/developers/development.md b/docs/book/src/developers/development.md index a056e5cf21e..b35dc4e99f9 100644 --- a/docs/book/src/developers/development.md +++ b/docs/book/src/developers/development.md @@ -46,7 +46,7 @@ ### Base requirements 1. Install [go][go] - - Get the latest patch version for go v1.19. + - Get the latest patch version for go v1.20. 2. Install [jq][jq] - `brew install jq` on macOS. - `sudo apt install jq` on Windows + WSL2 diff --git a/go.mod b/go.mod index f352d363d82..c68541291fc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module sigs.k8s.io/cluster-api-provider-azure -go 1.19 +go 1.20 require ( github.com/Azure/aad-pod-identity v1.8.15 diff --git a/hack/ensure-go.sh b/hack/ensure-go.sh index 7d2c6b945d1..5016956610a 100755 --- a/hack/ensure-go.sh +++ b/hack/ensure-go.sh @@ -31,7 +31,7 @@ EOF local go_version IFS=" " read -ra go_version <<< "$(go version)" local minimum_go_version - minimum_go_version=go1.19.0 + minimum_go_version=go1.20.0 if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then cat <