Add format check to CI #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Static Check Analysis" | |
on: ["pull_request"] | |
jobs: | |
static-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 'stable' | |
- name: Staticcheck | |
uses: dominikh/[email protected] | |
with: | |
version: "2023.1.3" | |
install-go: false | |
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@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
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 |