Skip to content

Commit 379ddb5

Browse files
committed
Use go.mod as source of Go version number for workflows
Go is used in the development and maintenance of the project. A standardized version of Go is used for all operations. This version is defined in the `go` directive of the go.mod metadata file. Go is installed in the GitHub Actions runner environments using the "actions/setup-go" action, which also must be configured to install the appropriate version of Go. Previously, the version number for use by the "actions/setup-go" action was defined in each workflow. This meant that we had multiple copies of the Go version information, all of which had to be kept in sync. Fortunately, support for using `go.mod` as the source of version information for the "actions/setup-go" action was recently added. This means it is now possible for all workflows to get the Go version from a single source.
1 parent 5d56c66 commit 379ddb5

6 files changed

+11
-33
lines changed

.github/workflows/check-go-dependencies-task.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md
22
name: Check Go Dependencies
33

4-
env:
5-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
6-
GO_VERSION: "1.23"
7-
84
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
95
on:
106
create:
@@ -87,7 +83,7 @@ jobs:
8783
- name: Install Go
8884
uses: actions/setup-go@v5
8985
with:
90-
go-version: ${{ env.GO_VERSION }}
86+
go-version-file: go.mod
9187

9288
- name: Install Task
9389
uses: arduino/setup-task@v2
@@ -146,7 +142,7 @@ jobs:
146142
- name: Install Go
147143
uses: actions/setup-go@v5
148144
with:
149-
go-version: ${{ env.GO_VERSION }}
145+
go-version-file: go.mod
150146

151147
- name: Install Task
152148
uses: arduino/setup-task@v2

.github/workflows/check-go-task.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md
22
name: Check Go
33

4-
env:
5-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
6-
GO_VERSION: "1.23"
7-
84
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
95
on:
106
create:
@@ -75,7 +71,7 @@ jobs:
7571
- name: Install Go
7672
uses: actions/setup-go@v5
7773
with:
78-
go-version: ${{ env.GO_VERSION }}
74+
go-version-file: go.mod
7975

8076
- name: Install Task
8177
uses: arduino/setup-task@v2
@@ -110,7 +106,7 @@ jobs:
110106
- name: Install Go
111107
uses: actions/setup-go@v5
112108
with:
113-
go-version: ${{ env.GO_VERSION }}
109+
go-version-file: go.mod
114110

115111
- name: Install Task
116112
uses: arduino/setup-task@v2
@@ -148,7 +144,7 @@ jobs:
148144
- name: Install Go
149145
uses: actions/setup-go@v5
150146
with:
151-
go-version: ${{ env.GO_VERSION }}
147+
go-version-file: go.mod
152148

153149
- name: Install Task
154150
uses: arduino/setup-task@v2
@@ -186,7 +182,7 @@ jobs:
186182
- name: Install Go
187183
uses: actions/setup-go@v5
188184
with:
189-
go-version: ${{ env.GO_VERSION }}
185+
go-version-file: go.mod
190186

191187
- name: Install Task
192188
uses: arduino/setup-task@v2
@@ -224,7 +220,7 @@ jobs:
224220
- name: Install Go
225221
uses: actions/setup-go@v5
226222
with:
227-
go-version: ${{ env.GO_VERSION }}
223+
go-version-file: go.mod
228224

229225
- name: Install Task
230226
uses: arduino/setup-task@v2

.github/workflows/publish-go-tester-task.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/publish-go-tester-task.md
22
name: Publish Tester Build
33

4-
env:
5-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
6-
GO_VERSION: "1.23"
7-
84
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
95
on:
106
create:
@@ -72,7 +68,7 @@ jobs:
7268
- name: Install Go
7369
uses: actions/setup-go@v5
7470
with:
75-
go-version: ${{ env.GO_VERSION }}
71+
go-version-file: go.mod
7672

7773
- name: Install Task
7874
uses: arduino/setup-task@v2

.github/workflows/release.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: Create Release
22

3-
env:
4-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
5-
GO_VERSION: "1.23"
6-
73
on:
84
push:
95
tags:
@@ -44,7 +40,7 @@ jobs:
4440
- name: Install Go
4541
uses: actions/setup-go@v5
4642
with:
47-
go-version: ${{ env.GO_VERSION }}
43+
go-version-file: go.mod
4844

4945
- name: Build project
5046
run: task build

.github/workflows/test-go-integration-task.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
name: Test Integration
33

44
env:
5-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
6-
GO_VERSION: "1.23"
75
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python
86
PYTHON_VERSION: "3.9"
97

@@ -88,7 +86,7 @@ jobs:
8886
- name: Install Go
8987
uses: actions/setup-go@v5
9088
with:
91-
go-version: ${{ env.GO_VERSION }}
89+
go-version-file: go.mod
9290

9391
- name: Install Python
9492
uses: actions/setup-python@v5

.github/workflows/test-go-task.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/test-go-task.md
22
name: Test Go
33

4-
env:
5-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
6-
GO_VERSION: "1.23"
7-
84
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
95
on:
106
create:
@@ -87,7 +83,7 @@ jobs:
8783
- name: Install Go
8884
uses: actions/setup-go@v5
8985
with:
90-
go-version: ${{ env.GO_VERSION }}
86+
go-version-file: go.mod
9187

9288
- name: Install Arduino Lint
9389
run: |

0 commit comments

Comments
 (0)