Skip to content

Contributing

Requirements: Go 1.26+

Terminal window
git clone https://github.com/LarsArtmann/gogenfilter.git
cd gogenfilter
go mod download
Terminal window
go build ./...
Terminal window
# Run all tests
go test ./...
# With race detector
go test -race ./...

Uses golangci-lint v2:

Terminal window
golangci-lint run

All pull requests must pass:

  • go build ./... — compiles cleanly
  • go test -race -cover ./... — tests pass with race detection
  • go vet ./... — no vet warnings
  • golangci-lint run — no new lint issues
  • Table-driven tests where possible
  • t.Parallel() within t.Run() for test isolation
  • Functional options pattern for configuration
  • Strong types over runtime checks
  • Early returns over nested conditionals
  1. Add a FilterOption and FilterReason const with the same string value in types.go
  2. Add a detector entry in the detectors table in detection.go
  3. Implement matchFilename (Phase 1) and/or checkContent (Phase 2) functions
  4. Add test fixtures in testdata/
  5. AllFilterOptions() and AllFilterReasons() update automatically

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.

Terminal window
go generate ./...

This updates five output files:

  • website/src/data/generators.json — consumed by Astro components
  • README.md — generator tables (between <!-- gendocs:*:start/end --> markers)
  • website/src/content/docs/generators.mdx — detection table + tool count
  • website/src/content/docs/api/detection.mdx — per-generator function table
  • doc.go — package comment generator list

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 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.

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.

  • Ensure all tests pass: go test -race ./...
  • Ensure linting passes: golangci-lint run
  • Add tests for new functionality
  • Keep changes focused and atomic