Skip to content

Limits

declscope reads one package at a time, and counts a use only where a name is written.

Not seen Consequence
Uses outside the package A scope beyond package could not be checked, so none exists
Whole-value operations on a struct Copying, comparing or zeroing a value names no field
Reflection, //go:linkname, generated files These reach a declaration without spelling it
A declaration nobody uses boundary needs a use to find, so unused code produces no diagnostic

For the last row, use an unused-code linter: deadcode, or staticcheck's unused for a library with no main to root from.