Skip to content

Commit c940040

Browse files
Update actions to use go.mod for Go version management
This commit changes all GitHub Actions to use the go.mod file for specifying the Go version instead of pinning the version directly. This reduces the burden of maintaining the Go version across multiple workflows.
1 parent 8911e2f commit c940040

File tree

29 files changed

+35
-35
lines changed

29 files changed

+35
-35
lines changed

.github/workflows/lint-sample.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: '~1.22'
21+
go-version-file: go.mod
2222
- name: Run linter
2323
uses: golangci/golangci-lint-action@v6
2424
with:

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
1616
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
1717
steps:
18+
- name: Clone the code
19+
uses: actions/checkout@v4
1820
- name: Setup Go
1921
uses: actions/setup-go@v5
2022
with:
21-
go-version: '~1.22'
22-
- name: Clone the code
23-
uses: actions/checkout@v4
23+
go-version-file: go.mod
2424
- name: Run linter
2525
uses: golangci/golangci-lint-action@v6
2626
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Go
2222
uses: actions/setup-go@v5
2323
with:
24-
go-version: '~1.22'
24+
go-version-file: go.mod
2525
- name: Clean dist directory
2626
run: rm -rf dist || true
2727
- name: Install Syft to generate SBOMs

.github/workflows/test-e2e-book.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Go
2828
uses: actions/setup-go@v5
2929
with:
30-
go-version: '~1.22'
30+
go-version-file: go.mod
3131

3232
- name: Install the latest version of kind
3333
run: |
@@ -57,7 +57,7 @@ jobs:
5757
- name: Setup Go
5858
uses: actions/setup-go@v5
5959
with:
60-
go-version: '~1.22'
60+
go-version-file: go.mod
6161

6262
- name: Install the latest version of kind
6363
run: |
@@ -87,7 +87,7 @@ jobs:
8787
- name: Setup Go
8888
uses: actions/setup-go@v5
8989
with:
90-
go-version: '~1.22'
90+
go-version-file: go.mod
9191

9292
- name: Install the latest version of kind
9393
run: |

.github/workflows/test-e2e-samples.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup Go
2424
uses: actions/setup-go@v5
2525
with:
26-
go-version: '~1.22'
26+
go-version-file: go.mod
2727

2828
- name: Install the latest version of kind
2929
run: |
@@ -62,7 +62,7 @@ jobs:
6262
- name: Setup Go
6363
uses: actions/setup-go@v5
6464
with:
65-
go-version: '~1.22'
65+
go-version-file: go.mod
6666

6767
- name: Install the latest version of kind
6868
run: |
@@ -104,7 +104,7 @@ jobs:
104104
- name: Setup Go
105105
uses: actions/setup-go@v5
106106
with:
107-
go-version: '~1.22'
107+
go-version-file: go.mod
108108

109109
- name: Install the latest version of kind
110110
run: |

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup Go
2727
uses: actions/setup-go@v5
2828
with:
29-
go-version: '~1.22'
29+
go-version-file: go.mod
3030
# This step is needed as the following one tries to remove
3131
# kustomize for each test but has no permission to do so
3232
- name: Remove pre-installed kustomize

docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: '~1.22'
18+
go-version-file: go.mod
1919

2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v6

docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/test-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: '~1.22'
18+
go-version-file: go.mod
1919

2020
- name: Install the latest version of kind
2121
run: |

docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: '~1.22'
18+
go-version-file: go.mod
1919

2020
- name: Running Tests
2121
run: |

docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: '~1.22'
18+
go-version-file: go.mod
1919

2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v6

0 commit comments

Comments
 (0)