Contributing
Development Setup
Section titled “Development Setup”Requirements: Go 1.26+, golangci-lint v2
git clone https://github.com/larsartmann/go-workflow-auditlog.gitcd go-workflow-auditloggo build ./...Commands
Section titled “Commands”| Command | Purpose |
|---|---|
go test ./... |
Run all tests |
go test -race ./... |
Run all tests with race detector |
go test -race -coverprofile=cover.out -covermode=atomic ./... |
Tests with coverage (~94%) |
go vet ./... |
Static analysis |
golangci-lint run ./... |
Lint (golangci-lint v2, 0 issues) |
go run ./example |
Run the demo pipeline |
Building
Section titled “Building”go build ./...Testing
Section titled “Testing”# Run all testsgo test ./...
# With race detectorgo test -race ./...Linting
Section titled “Linting”Uses golangci-lint v2 with strict defaults. Configuration lives in .golangci.yml.
# Run all configured linters — MUST exit with 0 issues before merginggolangci-lint run ./...
# Auto-fix formatting/importsgolangci-lint run ./... --fixCode Style
Section titled “Code Style”- Standard
testingpackage — no testify or other test utilities - Table-driven tests with
t.Runsubtests - External test package (
auditlog_test) - Early returns over nested conditionals
- Strong types over runtime checks
t.Setenv()for env var tests (runs sequentially)
Testing Patterns
Section titled “Testing Patterns”The test suite uses shared helpers (in auditlog_test.go) for common workflow fixtures:
mustNew,newAuditAndWorkflow— construct auditor + workflowaddRetryStep,addParallelSteps,addDependentStep,addLinearChain— wire step DAG patternsrunWorkflow— Attach + Do + Snapshot in one callassertStepCount,assertEventCount,assertStatus, etc. — typed assertions
Retry tests use fresh backoff.NewExponentialBackOff() instances to avoid a known data race in go-workflow v0.1.13.
All pull requests must pass:
go build ./...— compiles cleanlygo test -race ./...— tests pass with race detectiongo vet ./...— no vet warningsgolangci-lint run ./...— no lint issues
Pull Requests
Section titled “Pull Requests”- Fork the repository and create a feature branch from
master. - Make your changes with tests.
- Ensure all checks pass.
- Submit a pull request describing the what and why.
- Ensure all tests pass:
go test -race ./... - Ensure linting passes:
golangci-lint run ./... - Add tests for new functionality
- Keep changes focused and atomic