chore: run gofmt
as part of workflow (#118)
#22
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: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
go: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: stable | |
- name: Check formatting | |
run: | | |
gofmt -w -s . | |
if [[ -n $(git diff --exit-code) ]]; then | |
echo "Go files were not formatted correctly:" | |
git diff | |
exit 1 | |
fi | |
- name: Build examples | |
working-directory: examples/go/ | |
run: find . -name 'go.mod' -execdir go build \; | |
- name: Run util tests | |
working-directory: util/ | |
run: find . -name 'go.mod' -execdir go test ./... \; |