From 89fbaf5b7f866369862435980272723841c71661 Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Tue, 29 Oct 2024 12:16:43 -0500 Subject: [PATCH] Use the Go toolchain installed by actions/setup-go Since version 1.21, Go may automatically download a different version of Go. Disable this behavior so that entire pipelines use only one version. The "go" and "toolchain" directives indicate the minimum version of Go required when importing and developing the module, respectively. We are concerned only with compatibility, so downgrade "toolchain" to 1.22.0. Issue: PGO-1898 See: https://go.dev/doc/toolchain --- .github/workflows/codeql-analysis.yaml | 5 +++++ .github/workflows/lint.yaml | 5 +++++ .github/workflows/test.yaml | 7 +++++-- .github/workflows/trivy.yaml | 5 +++++ go.mod | 2 -- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index ceb95e51f6..1bcac4f26d 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -9,6 +9,11 @@ on: schedule: - cron: '10 18 * * 2' +env: + # Use the Go toolchain installed by setup-go + # https://github.com/actions/setup-go/issues/457 + GOTOOLCHAIN: local + jobs: analyze: runs-on: ubuntu-latest diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b424dc4915..c715f2a1d7 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -3,6 +3,11 @@ name: Linters on: pull_request: +env: + # Use the Go toolchain installed by setup-go + # https://github.com/actions/setup-go/issues/457 + GOTOOLCHAIN: local + jobs: golangci-lint: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b980a7211d..c614e8fdda 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,6 +7,11 @@ on: - main - master +env: + # Use the Go toolchain installed by setup-go + # https://github.com/actions/setup-go/issues/457 + GOTOOLCHAIN: local + jobs: go-test: runs-on: ubuntu-latest @@ -35,7 +40,6 @@ jobs: - run: ENVTEST_K8S_VERSION="${KUBERNETES#default}" make check-envtest env: KUBERNETES: "${{ matrix.kubernetes }}" - GOEXPERIMENT: nocoverageredesign # https://go.dev/issue/65653 GO_TEST: go test --coverprofile 'envtest.coverage' --coverpkg ./internal/... # Upload coverage to GitHub @@ -71,7 +75,6 @@ jobs: - run: make createnamespaces check-envtest-existing env: PGO_TEST_TIMEOUT_SCALE: 1.2 - GOEXPERIMENT: nocoverageredesign # https://go.dev/issue/65653 GO_TEST: go test --coverprofile 'envtest-existing.coverage' --coverpkg ./internal/... # Upload coverage to GitHub diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index 0dd0a644a2..02986b2516 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -7,6 +7,11 @@ on: - main - master +env: + # Use the Go toolchain installed by setup-go + # https://github.com/actions/setup-go/issues/457 + GOTOOLCHAIN: local + jobs: licenses: runs-on: ubuntu-latest diff --git a/go.mod b/go.mod index 04adda6833..d268d66018 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/crunchydata/postgres-operator go 1.22.0 -toolchain go1.22.4 - require ( github.com/go-logr/logr v1.4.2 github.com/golang-jwt/jwt/v5 v5.2.1