Star on GitHub

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.

Get Started →
$ go get github.com/LarsArtmann/gogenfilter
main.go
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
}

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.

P1

Phase 1: Filename

Scan for .pb.go and _templ.go and wire_gen.go

Zero I/O — no file reads
P2

Phase 2: Content

Scan for "Code generated by" and stringer iota markers

Only runs when Phase 1 is inconclusive

Why gogenfilter?

Purpose-built for Go. Not a generic file filter.

DIY
DIY
No filename detection
Manual pattern maintenance
No metrics
gogenfilter
Free
11 generators, table-driven
Two-phase (zero I/O first)
Thread-safe metrics
fs.FS testable
Pattern scoping
Heavy
Heavy
Requires go/ast import
Slow (parse entire file)
Overkill for filtering

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