Hunt down Go interface implementations like a bloodhound with trust issues.
Tired of grep-ing through thousands of lines trying to figure out which structs actually implement that damn interface? This tool does the heavy lifting so you don't have to suffer through another existential crisis at 3am.
go install github.com/psyb0t/gofindimpl@latestOr skip the install and run it directly:
go run github.com/psyb0t/gofindimpl@latest \
-interface ./path/to/file.go:InterfaceName \
-dir ./search/directoryNeeds Go 1.26 or newer.
Run it from your module root, the directory with go.mod in it. Not some anarchist directory, it checks.
gofindimpl \
-interface ./internal/app/server.go:Server \
-dir ./internal/pkg/You get JSON on stdout, because XML is for people who hate themselves:
[
{
"package": "impl",
"struct": "WebServer",
"packagePath": "github.com/yourproject/internal/pkg/impl"
},
{
"package": "mock",
"struct": "MockServer",
"packagePath": "github.com/yourproject/internal/pkg/mock"
}
]Add -debug if you're a masochist and want to watch every directory get walked. Logs go to stderr, so the JSON stays clean enough to pipe into jq. Every flag, the output fields and the exit codes are on Command line.
It parses the interface file, walks -dir, type-checks every package it finds with Go's own type checker and a fake importer, and reports each struct whose value or pointer method set has every method name the interface declares. Test files, vendor, node_modules and dot-directories don't get analyzed.
Read the fine print before you trust the output. It compares method names, not signatures, it ignores embedded interfaces, it can't see methods promoted from another package, and with the default -dir . it skips the package in the module root itself. How it works has all of it.
The full docs live at psyb0t.github.io/gofindimpl.
| Page | What's in it |
|---|---|
| Command line | Flags, the file.go:InterfaceName spec, JSON output, logs and exit codes |
| How it works | What gets scanned, what counts as an implementation, and the limits |
| Troubleshooting | Every error message, why a search comes back empty, and why it finds too much |
| Development | Make targets, tests, the coverage gate, CI and releases |
MIT, because pkg.go.dev are corporate fuckers who won't index WTFPL packages.
