Skip to content

Commit 6599b43

Browse files
committed
Add a gofmt lint job
1 parent 1d2fc54 commit 6599b43

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/matrix-tools.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: AGPL-3.0-only
44

5-
name: Build matrix-tool Docker Images
5+
name: matrix-tools linting and building
66

77
on:
88
pull_request:
@@ -18,6 +18,27 @@ env:
1818
GO_VERSION: "1.24"
1919

2020
jobs:
21+
gofmt:
22+
permissions:
23+
contents: read
24+
packages: read
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
28+
29+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
30+
with:
31+
go-version: "${{ env.GO_VERSION }}"
32+
33+
- name: gofmt check
34+
run: |
35+
unformatted_files="$(gofmt -l matrix-tools)"
36+
if [ "$unformatted_files" != "" ]; then
37+
echo "There are .go files that aren't formatted correctly:"
38+
echo "$unformatted_files"
39+
exit 1
40+
fi
41+
2142
tests:
2243
permissions:
2344
contents: read

newsfragments/792.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CI: check that all go files are formatted correctly as per `gofmt`.

0 commit comments

Comments
 (0)