Inspectopedia Help

Unused dependency

Reports unused dependencies.

For each dependency in the current go.mod file, this inspection searches for any import statement starting with the dependency name in all GO files. If no such imports found then the dependency is considered unused. This inspection is an equivalent of the go mod why command.

The inspection processes require and replace directives. The require directives with // indirect comments are also processed.

The inspection might not accurately determine that a replaced or indirectly-required dependency is unused in the following cases:

  • Vendoring mode is enabled

  • Some dependencies are not downloaded

Inspection Details

Available in:

GoLand 2023.3



Last modified: 13 July 2023