Skip to content

Commit

Permalink
Reduce maintenance burden by letting setup-go track our Go versions
Browse files Browse the repository at this point in the history
`actions/setup-go` supports "stable" and "oldstable" as automatic aliases for the latest release and the previous to latest release, which was our intent with two of these three hard-coded versions.  The third is hard-coded to match our `go.mod`, which `actions/setup-go` *also* supports reading from, so we can be completely DRY here.

Signed-off-by: Tianon Gravi <[email protected]>
  • Loading branch information
tianon committed Dec 12, 2024
1 parent 5325ec4 commit 00584ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/docs-and-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
strategy:
matrix:
# current Go releases plus the version in the go.mod are tested
go: ['1.18', '1.22', '1.23']
go: ['go.mod', 'oldstable', 'stable']
# https://github.com/actions/setup-go/tree/v5#getting-go-version-from-the-gomod-file
# https://github.com/actions/setup-go/tree/v5#using-stableoldstable-aliases

env:
RELEASE_GO_VER: "1.23"
Expand All @@ -24,7 +26,8 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
go-version: ${{ matrix.go != 'go.mod' && matrix.go || null }}
go-version-file: ${{ matrix.go == 'go.mod' && 'go/src/github.com/opencontainers/image-spec/go.mod' || null }}

- name: Render and Lint
env:
Expand Down

0 comments on commit 00584ff

Please sign in to comment.