GoLand 2022.3 Help

Code Inspections in Go modules

This topic lists all GoLand code inspections available in Go modules.

You can toggle specific inspections or change their severity level on the Editor | Inspections page of the IDE settings Ctrl+Alt+S.



Default Severity

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

Warning Warning

Last modified: 12 December 2022