Skip the generated noise.
Detect and filter auto-generated Go code files from sqlc, protobuf, templ, mockgen, and 7 more tools. Built for linters and static analysis.
package main
import (
"fmt"
"github.com/LarsArtmann/gogenfilter"
)
func main() {
f := gogenfilter.NewFilter(
gogenfilter.Enabled(),
gogenfilter.WithFilterOptions(gogenfilter.FilterAll),
)
filtered, _ := f.ShouldFilter("db/models.go")
fmt.Println(filtered) // true — sqlc generated
} 11 generators. One filter.
Detects output from every major Go code generation tool.
Built by LarsArtmann
Engineered for performance.
Every API decision optimized for real-world static analysis pipelines.
Two-Phase Detection
Filename check first (zero I/O), content scan only when needed.
Functional Options API
Clean, composable configuration. Immutable after construction.
Glob Pattern Matching
Include/exclude with ** glob support via doublestar.
Thread-Safe Metrics
Track what was filtered and why, concurrently.
SQLC Config Discovery
Parse sqlc.yaml to find output directories automatically.
fs.FS Abstraction
Pluggable filesystem. Test with fstest.MapFS, no real files needed.
Two-phase detection.
Filename first, content second. Most files are classified without reading a single byte.
Phase 1: Filename
Scan for .pb.go and _templ.go and wire_gen.go
Phase 2: Content
Scan for "Code generated by" and stringer iota markers
Why gogenfilter?
Purpose-built for Go. Not a generic file filter.
Built for real tools.
Drop it into any linter, analyzer, or CI pipeline.
Linters
Skip generated files in static analysis
Code Quality
Exclude generated code from metrics
CI / CD
Filter noise from review tooling
Start filtering in seconds.
Three lines to filter all generated code from your project.
Read the Docs