Skip to content

Commit

Permalink
Add Go format checks to CI
Browse files Browse the repository at this point in the history
Different contributors work on different IDEs and configurations.
This check will help to catch format errors before merging.
The `go fmt` tool marks the standard for formatting.

Signed-off-by: Aitor Perez Cedres <[email protected]>
  • Loading branch information
Zerpet committed Sep 27, 2023
1 parent a6cced8 commit a9f1be8
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/static-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,27 @@ jobs:
with:
version: "2023.1.3"
install-go: false
build-tags: "rabbitmq.stream.test,rabbitmq.stream.e2e"
build-tags: "rabbitmq.stream.test,rabbitmq.stream.e2e"

format-check:
name: Check Go Formatting
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable

- name: Run gofmt check
run: |
go fmt ./...
changes=$(git status --porcelain)
if [ -n "$changes" ]; then
echo "The following Go files are not formatted correctly:"
echo "$changes"
exit 1
fi

0 comments on commit a9f1be8

Please sign in to comment.