Skip to content

Commit 88a2d36

Browse files
committed
ci: add golangci-lint and gofumpt workflows
1 parent 55ff750 commit 88a2d36

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
golangci-lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-go@v5
18+
with:
19+
go-version-file: go.mod
20+
21+
- uses: golangci/golangci-lint-action@v7
22+
with:
23+
version: v2.9.0
24+
25+
gofumpt:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: actions/setup-go@v5
31+
with:
32+
go-version-file: go.mod
33+
34+
- name: Install gofumpt
35+
run: go install mvdan.cc/gofumpt@latest
36+
37+
- name: Check formatting
38+
run: |
39+
unformatted=$(gofumpt -l .)
40+
if [ -n "$unformatted" ]; then
41+
echo "Files not formatted with gofumpt:"
42+
echo "$unformatted"
43+
echo ""
44+
echo "Run 'gofumpt -w .' to fix."
45+
exit 1
46+
fi

0 commit comments

Comments
 (0)