Skip to content

Github Actions workflow to check building and formatting #1

Github Actions workflow to check building and formatting

Github Actions workflow to check building and formatting #1

Workflow file for this run

name: Run tests
on:
pull_request:
branches: [master]
push:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: go build -v ./...
- name: gofmt
run: |
unformatted_files=$(gofmt -l .)
if [ -n "$unformatted_files" ]; then
echo "The following files are not Go formatted:"
echo "$unformatted_files"
echo "Please run 'gofmt -w .' to fix them."
exit 1
fi
echo "All Go files are well formatted."