gofindimpl: Stop Grep-ing for Go Interface Implementations Like a Damn Amateur

Look, if you’ve ever wasted more than 5 minutes trying to hunt down which structs actually implement a Go interface, you already know this pain. It’s like trying to debug a race condition with printf statements – technically possible but guaranteed to make you question every life choice that led you to this moment.

The Shitshow Nobody Wants to Admit

Go’s implicit interface satisfaction is fucking brilliant until you actually need to find the implementations. Your fancy IDE works great when it feels like it, but what about when you’re knee-deep in a legacy codebase that looks like it was written by someone having an existential crisis? Or when you need to programmatically discover implementations because your deployment script needs to know what the hell it’s actually deploying?

You fire up grep, start with some reasonable regex, and two hours later you’re crafting increasingly desperate patterns that would make a Perl monk weep into his keyboard. Meanwhile, you’re drowning in false positives and missing half the actual implementations because they’re spread across seventeen different packages with names like pkg/internal/legacy/wtf/impl.

Enter gofindimpl: The Tool That Actually Works

I built gofindimpl because I got sick of wasting my life on this repetitive horseshit. It’s a command-line tool that actually understands Go’s type system instead of pretending string matching is a valid approach to static analysis.

This thing uses Go’s actual type checker – you know, the same one that validates your code when you build it. It parses your interface definition, crawls through your entire codebase like a determined spider, and spits out exactly which structs implement that interface. No regex prayers, no false positives, no bullshit – just facts in clean JSON format that you can actually use.

How This Shit Actually Works

The tool does what any sane implementation finder should do, but somehow nobody else bothered:

  1. Parse the interface from wherever the fuck you tell it to look
  2. Crawl through your codebase recursively (smart enough to skip vendor dirs and other garbage)
  3. Use Go’s actual type checker because pretending you can validate method signatures with regex is insane
  4. Match method sets properly between structs and your interface
  5. Dump clean JSON with all the package details you actually need

No regex nightmares, no string matching disasters, no crossing your fingers and hoping – just actual type analysis like a civilized human being.

Usage That Won’t Make You Hate Life

# Install it once and forget about it
go install github.com/psyb0t/gofindimpl@latest
# Actually find your fucking implementations
gofindimpl \
  -interface ./internal/app/server.go:Server \
  -dir ./internal/pkg/

Or if you don’t want to install random shit on your machine:

go run github.com/psyb0t/gofindimpl@latest \
  -interface ./path/to/file.go:InterfaceName \
  -dir ./search/directory

The output is sensible JSON that you can actually work with:

[
  {
    "package": "impl",
    "struct": "WebServer",
    "packagePath": "github.com/yourproject/internal/pkg/impl"
  },
  {
    "package": "mock",
    "struct": "MockServer",
    "packagePath": "github.com/yourproject/internal/pkg/mock"
  }
]

Why This Actually Doesn’t Suck

Unlike the seventeen broken approaches you’ve probably already tried, gofindimpl:

  • Actually understands Go’s type system instead of hoping regex will save you
  • Handles value and pointer receivers correctly (shocking, I know)
  • Skips test files automatically because finding test mocks is fucking pointless
  • Gives you real error messages instead of failing silently like a passive-aggressive teammate
  • Works from any Go module without requiring you to sacrifice a goat to the toolchain gods

Plus it has 90.8% test coverage because shipping untested code is for amateurs who enjoy fixing production bugs at 3am on weekends.

The Bottom Line

If you’re still grep-ing for interface implementations in 2025, you’re doing it wrong. Go grab gofindimpl from GitHub and stop wasting your time on stupid fuckin’ shit.

Your future self will thank you when you’re not spending your 3am debugging sessions trying to figure out which random struct buried in some vendor dependency actually implements that critical interface.

Now stop reading and go hunt some fuckin’ interface implementations!