Inspectopedia 2024.3 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

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

VgoUnusedDependency
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Go modules | Declaration redundancy

Inspection Details

By default bundled with:

GoLand 2024.3, Qodana for Go 2024.3,

Can be installed with plugin:

Go, 243.23131

Last modified: 03 December 2024