Contributing
Development Setup
Section titled “Development Setup”Requirements: Go 1.26+, Nix Flakes (recommended)
git clone https://github.com/larsartmann/go-filewatcher.gitcd go-filewatcher
# Using Nix (recommended)nix develop # Enter dev shell with all toolsdirenv allow # Or auto-load on cd
# Without Nixgo mod downloadBuilding
Section titled “Building”go build ./...# or via Nix:nix build .Testing
Section titled “Testing”# Run all tests with race detectionnix run .#test# or: go test -race ./...
# Verbosenix run .#test-vLinting
Section titled “Linting”Uses golangci-lint with 50+ linters at their strictest defaults. Configuration lives in .golangci.yml.
# Run all linters — MUST exit with 0 issues before mergingnix run .#lint# or: golangci-lint run ./...
# Auto-fix formatting/importsnix run .#lint-fix# or: golangci-lint run ./... --fixFull CI Pipeline
Section titled “Full CI Pipeline”nix run .#ci # tidy + fmt + vet + lint + testnix run .#check # vet + lint + testCode Style
Section titled “Code Style”- Single root package (
filewatcher) — nointernal/orpkg/subdirectories - Standard
testingpackage — no testify t.Parallel()on all tests (enforced byparalleltestlinter)t.TempDir()for filesystem isolation- All struct fields must be initialized (enforced by
exhaustructlinter) - All errors must be wrapped (enforced by
wrapchecklinter) - Early returns over nested conditionals
- Strong types over runtime checks
- Functional options pattern for configuration
Website
Section titled “Website”The documentation website lives in website/:
cd websitenpm installnpm run dev # Start dev servernpm run build # Build for productionPull Requests
Section titled “Pull Requests”- Ensure all tests pass:
nix run .#check - Ensure linting passes:
nix run .#lint - Add tests for new functionality
- Keep changes focused and atomic
- Follow existing patterns and conventions