Contributing
Development Setup
Section titled “Development Setup”Requirements: Go 1.26+, Templ CLI, golangci-lint
The project uses Nix flakes for reproducible development environments:
NIXPKGS_ALLOW_UNFREE=1 nix develop --impureOr without Nix:
git clone https://github.com/LarsArtmann/dynamic-markdown-site.gitcd dynamic-markdown-sitego mod downloadgo install github.com/a-h/templ/cmd/templ@latestBuilding
Section titled “Building”# Generate Templ templates (required after editing .templ files)templ generate
# Buildgo build ./cmd/dynamic-markdown-siteTesting
Section titled “Testing”# Run all tests with race detection and coveragego test ./... -race -cover -coverprofile=coverage.out
# Verbosego test ./... -race -v
# Benchmarksgo test ./... -bench=. -benchmemLinting
Section titled “Linting”Uses golangci-lint with ~75 linters configured in .golangci.yml. Must produce zero issues:
golangci-lint run ./...CI Pipeline
Section titled “CI Pipeline”All pull requests must pass:
go test -race -cover— tests pass with 75% coverage floorgolangci-lint run ./...— no lint issuestempl generate— generated files must be checked in
Code Style
Section titled “Code Style”- Standard
testingpackage — testify only used in some tests t.Parallel()where possiblet.TempDir()for filesystem isolation- Early returns over nested conditionals
- Strong types over runtime checks
- Full word variable names (no single letters)
- Wrap errors with
cockroachdb/errorsand add context *slog.Loggerviacharm.land/log— never log secrets
Adding Dependencies
Section titled “Adding Dependencies”New third-party imports require updating the depguard.rules.main.allow list in .golangci.yml.
Pull Requests
Section titled “Pull Requests”- Keep changes focused and atomic
- Add tests for new functionality
- Ensure all CI checks pass
- Run
templ generateand commit the result if you changed.templfiles