Skip to content

Commit 969701a

Browse files
authored
Merge pull request #57 from meshcloud/feature/gofmt-ci-pipeline
feat: update CI to enforce gofmt formatting
2 parents 24c71d1 + 72f3453 commit 969701a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ jobs:
3434
# with:
3535
# version: latest
3636

37+
format:
38+
name: Go Format Check
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: actions/setup-go@v5
44+
with:
45+
go-version-file: 'go.mod'
46+
cache: true
47+
- name: Check Go formatting
48+
run: |
49+
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
50+
echo "The following files are not formatted correctly:"
51+
gofmt -l .
52+
echo "Please run 'gofmt -w .' (or configure your IDE to automatically run gofmt upon save) to fix formatting issues."
53+
exit 1
54+
fi
55+
3756
generate:
3857
runs-on: ubuntu-latest
3958
steps:
@@ -54,7 +73,7 @@ jobs:
5473
# Run acceptance tests in a matrix with Terraform CLI versions
5574
test:
5675
name: Terraform Provider Acceptance Tests
57-
needs: build
76+
needs: [build, format]
5877
runs-on: ubuntu-latest
5978
timeout-minutes: 15
6079
strategy:

0 commit comments

Comments
 (0)