Contributing
Development Setup
Section titled “Development Setup”Requirements: Go 1.27+, Nix (optional, recommended)
git clone https://github.com/LarsArtmann/cmdguard.gitcd cmdguardnix develop # or: ensure GOEXPERIMENT=jsonv2 is setgo mod downloadBuilding
Section titled “Building”go build ./...Testing
Section titled “Testing”# All tests with race detectiongo test ./... -count=1 -timeout 120s -race
# Coverage reportgo test ./... -count=1 -timeout 120s -coverLinting
Section titled “Linting”golangci-lint run ./...The project maintains 0 lint issues via real code fixes, not silencing linters.
Sub-Modules
Section titled “Sub-Modules”Each sub-module (glamour, prompts, spinner, telemetry, flightrecorder, lint, schema) has its own go.mod. Build and test them individually:
for m in glamour prompts spinner telemetry flightrecorder lint schema; do (cd $m && go build ./... && go test ./...)doneCode Style
Section titled “Code Style”gofumptformatting (viagolangci-lint fmt)t.Parallel()in every test function and subtest//nolint:paralleltestfor tests usingt.Setenv- Table-driven tests:
tests := []struct{...}pattern - Single internal test package (
v5, accesses private helpers) - Error wrapping:
fmt.Errorf("context: %w", err) - Functional options pattern for all configuration
- No panics in library code — all functions return errors
All pull requests must pass:
go build ./...— compiles cleanlygo test -race ./...— tests pass with race detectiongolangci-lint run— no lint issues
Localization
Section titled “Localization”The site is English-only by decision: no hreflang alternates are emitted and
none are planned until a second language actually ships. Do not add locale
scaffolding (i18n routing, language pickers, hreflang link tags) without a
real second-language content source.
Pull Requests
Section titled “Pull Requests”- Ensure all tests pass:
go test -race ./... - Ensure linting passes:
golangci-lint run ./... - Add tests for new functionality
- Keep changes focused and atomic
- Follow existing patterns (check similar code)
BuildFlow Pre-commit Hook
Section titled “BuildFlow Pre-commit Hook”The pre-commit hook runs golangci-lint + formatters automatically. Auto-fixes are applied, so commits proceed normally without --no-verify.
Where to go next
Section titled “Where to go next”- Changelog: what changed in each major.
- Related Tools: the libraries cmdguard builds on.
- GitHub issues: report a bug or propose a change.