Finding unreachable functions with deadcode - The Go Programming Language
The Go Blog
Functions that are part of your project’s source code but can never be
reached in any execution are called “dead code”, and they exert a drag
on codebase maintenance efforts.
Today we’re pleased to share a tool named deadcode to help you identify them.
$ go install golang.org/x/tools/cmd/deadcode@latest
$ deadcode -help
The deadcode command reports unreachable functions in Go programs.
Usage: deadcode [flags] package...
Example
Over the last year or so, we’ve been making a lot of cha...
Read more at go.dev