Skip to content

Merge pull request #2 from farbodahm/feature/add-ci #4

Merge pull request #2 from farbodahm/feature/add-ci

Merge pull request #2 from farbodahm/feature/add-ci #4

Workflow file for this run

name: Go Build and Format
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
go:
name: Go ${{ matrix.task }}
runs-on: ubuntu-latest
strategy:
matrix:
task: [fmt, build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "^1.20"
- name: Install dependencies
run: go mod tidy
- name: Run go fmt
if: matrix.task == 'fmt'
run: |
if [ -n "$(go fmt ./...)" ]; then
echo "Go files must be formatted with gofmt. Please run 'go fmt ./...' locally."
exit 1
fi
- name: Run go build
if: matrix.task == 'build'
run: go build ./...