Stop linting code no human wrote.
gogenfilter detects files from 18 Go code generators — sqlc, protobuf, templ, and more — so your linters, analyzers, and CI skip them automatically.
New to code generation? Tools like sqlc, protobuf, and templ produce .go files automatically from schemas, proto definitions, and templates. They're valid Go — but no engineer wrote or maintains them.
package main
import (
"fmt"
"github.com/LarsArtmann/gogenfilter/v3"
)
func main() {
opts, err := gogenfilter.WithFilterOptions(gogenfilter.FilterAll)
if err != nil {
panic(err)
}
f, err := gogenfilter.NewFilter(opts)
if err != nil {
panic(err)
}
filtered, _ := f.Filter("db/models.go")
fmt.Println(filtered) // true — sqlc generated
} 18 generators. One filter.
Detects output from every major Go code generation tool.
Built by LarsArtmann
Built to do one thing well.
No magic, no bloat. Just fast, accurate detection you can drop into any pipeline.
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.
Detailed Results
FilterResult with reason, trace, and path for every file.
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
Every file classified — zero ambiguity
See the difference.
Generated files vanish from your linter output.
Add one call to your analyzer. Every generated file disappears from the results.
Illustrative example — file names and issue counts are representative.
Who is this for?
If you build or run Go tooling that analyzes source code, you need this.
Linters
Skip generated files in static analysis
Code Quality
Exclude generated code from reports
CI / CD
Filter noise from review tooling
Three lines. That's the whole API.
Free, MIT-licensed, and ready to drop into your next analyzer.
Trusted by Go tooling
gogenfilter is used by linters, analyzers, and CI pipelines that need to skip generated code. See who depends on it.
View dependents