Skip to content

Commit 9cee6c6

Browse files
committed
go.mod: don't enforce latest go version
Commit e9d8229 updated the version of go to use for this module, but also updated the go directive in go.mod, preventing users of this module to use lower versions. For modules used as library, Go generally recommends supporting at least the current stable and "oldstable" (stable -1) releases. This patch: - downgrades the go directive in go.mod to go1.25 - updates github actions workflows to test both the specified version (1.26) and the version specified in go.mod (minimal version). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 43c3295 commit 9cee6c6

5 files changed

Lines changed: 34 additions & 12 deletions

File tree

.github/workflows/check.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ jobs:
1010
# Linter checker
1111
#
1212
linters:
13-
name: Linters
13+
name: Linters (${{ matrix.go-version || 'minimum' }})
1414
runs-on: ubuntu-22.04
1515
timeout-minutes: 10
1616

1717
strategy:
1818
matrix:
19-
go-version: [1.26]
20-
19+
go-version:
20+
- "" # empty; fall back on go-version-file (use go.mod); see https://github.com/actions/setup-go/issues/450#issuecomment-3620402646
21+
- 1.26
2122
steps:
22-
- uses: actions/setup-go@v6
23+
- uses: actions/checkout@v6
24+
- name: install Go
25+
uses: actions/setup-go@v6
2326
with:
2427
go-version: ${{ matrix.go-version }}
25-
26-
- uses: actions/checkout@v6
28+
go-version-file: "go.mod" # used when go-version is not specified.
29+
check-latest: true
2730
- uses: golangci/golangci-lint-action@v9
2831
with:
2932
version: v2.9

.github/workflows/ci-unit-test.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ on:
99

1010
jobs:
1111
unit-test:
12-
name: Unit Test
12+
name: Unit Test (${{ matrix.go-version || 'minimum' }})
1313
runs-on: ubuntu-22.04
1414
timeout-minutes: 10
15-
15+
strategy:
16+
matrix:
17+
go-version:
18+
- "" # empty; fall back on go-version-file (use go.mod); see https://github.com/actions/setup-go/issues/450#issuecomment-3620402646
19+
- 1.26
1620
steps:
1721
- uses: actions/checkout@v6
1822
with:
@@ -22,7 +26,9 @@ jobs:
2226
- name: install Go
2327
uses: actions/setup-go@v6
2428
with:
25-
go-version: '1.26'
29+
go-version: ${{ matrix.go-version }}
30+
go-version-file: "go.mod" # used when go-version is not specified.
31+
check-latest: true
2632

2733
- name: set env
2834
shell: bash

.github/workflows/ci-userspace-convertor.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ on:
1414

1515
jobs:
1616
run-ci-userspace-convertor:
17-
name: Run CI | Userspace Convertor
17+
name: Run CI | Userspace Convertor (${{ matrix.go-version || 'minimum' }})
1818
runs-on: ubuntu-22.04
1919
timeout-minutes: 10
20+
strategy:
21+
matrix:
22+
go-version:
23+
- "" # empty; fall back on go-version-file (use go.mod); see https://github.com/actions/setup-go/issues/450#issuecomment-3620402646
24+
- 1.26
2025
container:
2126
image: ghcr.io/${{ inputs.github-repository }}/overlaybd-ci-images:${{ inputs.image-tag }}
2227
credentials:
@@ -85,7 +90,9 @@ jobs:
8590
- name: install Go
8691
uses: actions/setup-go@v6
8792
with:
88-
go-version: '1.26'
93+
go-version: ${{ matrix.go-version }}
94+
go-version-file: "go.mod" # used when go-version is not specified.
95+
check-latest: true
8996

9097
- name: set env
9198
shell: bash

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- uses: actions/setup-go@v6
2626
with:
2727
go-version: '1.26'
28+
check-latest: true
2829

2930
# Initializes the CodeQL tools for scanning.
3031
- name: Initialize CodeQL

go.mod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
module github.com/containerd/accelerated-container-image
22

3-
go 1.26.0
3+
// The go directive declares the minimum Go version required for this module.
4+
//
5+
// DO NOT change this version unless support for older Go versions is dropped
6+
// or the module requires newer Go features. To update the version used for CI
7+
// and releases, update "go-version" and "GO_VERSION" in "/.github/workflows".
8+
go 1.25
49

510
require (
611
github.com/containerd/containerd/api v1.8.0

0 commit comments

Comments
 (0)