Skip to content

Commit

Permalink
Use the Go toolchain installed by actions/setup-go
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cbandy committed Oct 29, 2024
1 parent 446c9c7 commit 89fbaf5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 89fbaf5

Please sign in to comment.