Inspectopedia 2025.2 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 ID: VgoUnusedDependency

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection VgoUnusedDependency

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

GoLand 2025.2, Qodana for Go 2025.2,

Can be installed with plugin:

Go, 252.26654.0

Last modified: 18 September 2025