Closed griesemer closed 7 years ago
This has probably been mentioned elsewhere, but I'll include a link here for future reference. Rémy has implemented some dead code detection at: https://github.com/remyoudompheng/go-misc/blob/master/deadcode/deadcode.go
Do we need this? If so, I could work on it in 1.9. Let me know.
IMHO, probably ok as an optional vet check, but as gri mentioned, it will give false positive on debug functions, so we can't make it part of the default checks.
Also note the check has to take test files and excluded files (via build tags) into consideration too. Such a test would be nice, but I think it's too complicated to get 100% right.
I think it's probably too hard to get the false positives rate low enough in the real world.
It might work as a lint check, which can be looser.
Closing.
I think that might be too much even for lint, but if anyone does want this check, https://github.com/dominikh/go-unused already does it.