Skip to content

refactor: Improve client initialization with functional options pattern #9

refactor: Improve client initialization with functional options pattern

refactor: Improve client initialization with functional options pattern #9

Workflow file for this run

name: pre-commit
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- "v[0-9]+*"
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: "."
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
cache: true
- name: Run gofmt
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go code is not formatted. Run 'gofmt -w .' to fix."
gofmt -d .
exit 1
fi
- name: Run go vet
run: go vet ./...
- name: Run go mod verify
run: go mod verify
- name: Run go mod tidy check
run: |
go mod tidy
# Check if go.mod has changed (go.sum may not exist if no dependencies)
if ! git diff --exit-code go.mod; then
echo "go.mod is not tidy. Run 'go mod tidy' to fix."
exit 1
fi
# Check go.sum only if it exists
if [ -f go.sum ]; then
if ! git diff --exit-code go.sum; then
echo "go.sum is not tidy. Run 'go mod tidy' to fix."
exit 1
fi
fi