Supported Generators
Overview
Section titled “Overview”gogenfilter detects files generated by 11 code generation tools through a two-phase approach: filename patterns first (zero I/O), then content markers.
Detection Methods
Section titled “Detection Methods”| Tool | Filename Detection | Content Detection |
|---|---|---|
| sqlc | models.go, querier.go, query.sql.go, batch.go, *.sql.go | "Code generated by sqlc", sqlc code patterns |
| templ | _templ.go suffix | templ.Component, Render(ctx context.Context, w io.Writer) |
| go-enum | _enum.go suffix | "Code generated by go-enum" |
| protobuf | .pb.go, _grpc.pb.go suffix | Any Code generated by comment |
| oapi-codegen | None | "oapi-codegen" content marker |
| deepcopy-gen | zz_generated.* prefix + .go suffix | "Code generated by deepcopy-gen" |
| wire | wire_gen.go suffix | "Code generated by Wire" |
| moq | _moq.go, _moq_test.go suffix | "Code generated by moq" |
| mockgen | _mock.go suffix, mock_ prefix | "Code generated by MockGen" |
| stringer | None | "Code generated by \"stringer\"" |
| Generic fallback | None | Any // Code generated by comment |
Generic Fallback
Section titled “Generic Fallback”The generic detector catches any tool that follows Go’s standard code generation comment convention from go.dev/s/generatedcode. This means even tools not explicitly supported will be detected if they include the standard comment.
Adding New Generators
Section titled “Adding New Generators”The detector table is the single source of truth. Each entry has:
- An
option(FilterOption) - A
reason(FilterReason) - An optional
matchFilenamefunction (Phase 1) - An optional
checkContentfunction (Phase 2)
Derived lists like AllFilterOptions() and AllFilterReasons() are auto-generated from this table.