Skip to content

Commit a4227a3

Browse files
Create main.yml
1 parent d9ebdb5 commit a4227a3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# .github/workflows/gofmt.yml
2+
name: Gofmt Check
3+
4+
on:
5+
push:
6+
branches:
7+
- '**'
8+
9+
jobs:
10+
gofmt:
11+
name: Run gofmt
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: '1.24.2'
22+
23+
- name: Check formatting with gofmt
24+
run: |
25+
unformatted=$(gofmt -l .)
26+
if [ -n "$unformatted" ]; then
27+
echo "The following files are not properly formatted:"
28+
echo "$unformatted"
29+
echo "Run 'gofmt -w .' to fix them."
30+
exit 1
31+
fi

0 commit comments

Comments
 (0)