-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.17 KB
/
format.yml
File metadata and controls
50 lines (42 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Go Format Check (format.yml)
permissions:
contents: read
pull-requests: read
concurrency:
group: pr-format-${{ github.event.pull_request.number }}
cancel-in-progress: true
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Check gofmt formatting
run: |
echo "Checking gofmt..."
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following files are not properly formatted:"
echo "$unformatted"
exit 1
fi
- name: Check goimports formatting
run: |
echo "Checking goimports..."
unformatted=$(goimports -l .)
if [ -n "$unformatted" ]; then
echo "The following files are not properly goimports-formatted:"
echo "$unformatted"
exit 1
fi