Contributing
Development Setup
Section titled “Development Setup”Requirements: Go 1.26+
git clone https://github.com/LarsArtmann/gogenfilter.gitcd gogenfiltergo mod downloadBuilding
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:
golangci-lint runAll pull requests must pass:
go build ./...— compiles cleanlygo test -race -cover ./...— tests pass with race detectiongo vet ./...— no vet warningsgolangci-lint run— no new lint issues
Code Style
Section titled “Code Style”- Table-driven tests where possible
t.Parallel()withint.Run()for test isolation- Functional options pattern for configuration
- Strong types over runtime checks
- Early returns over nested conditionals
Adding a Generator
Section titled “Adding a Generator”- Add a
FilterOptionandFilterReasonconst with the same string value intypes.go - Add a detector entry in the
detectorstable indetection.go - Implement
matchFilename(Phase 1) and/orcheckContent(Phase 2) functions - Add test fixtures in
testdata/ AllFilterOptions()andAllFilterReasons()update automatically
Documentation Generation (gendocs)
Section titled “Documentation Generation (gendocs)”The detectors table in detection.go is the single source of truth for all
generator data. The cmd/gendocs binary reads this table and generates
documentation artifacts automatically.
Running gendocs
Section titled “Running gendocs”go generate ./...This updates five output files:
website/src/data/generators.json— consumed by Astro componentsREADME.md— generator tables (between<!-- gendocs:*:start/end -->markers)website/src/content/docs/generators.mdx— detection table + tool countwebsite/src/content/docs/api/detection.mdx— per-generator function tabledoc.go— package comment generator list
Adding Website Metadata
Section titled “Adding Website Metadata”Each detector needs presentation data (display name, logo, example filename) that
isn’t derivable from Go source. Add this to the websiteMetadata map in
cmd/gendocs/main.go. If you add a detector without metadata, gendocs will
fail with a validation error.
CI Enforcement
Section titled “CI Enforcement”CI runs go generate ./... && git diff --exit-code to verify generated docs are
fresh. If you modify the detectors table, always run go generate ./... and
commit the output.
Website Development
Section titled “Website Development”The website uses Astro v6 + Starlight + Tailwind v4. The color system uses a
warm-stone background palette with a three-color accent rotation (cyan, amber,
emerald). See docs/adr/001-color-system.md
for the full decision record and instructions for adding new accent colors.
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