Add Go code formatting

This commit is contained in:
Mike Fridman 2022-05-27 19:14:46 -04:00
parent d272f4dadc
commit 1697222a72
2 changed files with 7 additions and 21 deletions

View File

@ -1,21 +0,0 @@
name: gofumpt
on:
push:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Auto Format code
uses: iamnotaturtle/auto-gofmt@v2.0.0
with:
only_changed: true

View File

@ -33,6 +33,13 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: "${{ matrix.go }}"
- name: Check Go code formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
gofmt -s -l .
echo "Please format Go code by running: go fmt ./..."
exit 1
fi
- name: Build
run: |
go vet ./...