Inspectopedia 2025.2 Help

Imported package name as a name identifier

Reports declarations of variables, arguments or functions that overlap with the used import.

While legal, such declarations will make using the package exported identifiers impossible after the declaration or create confusion when reading the code.

Example:

import "fmt" import _ "fmt" import iio "io" func _() { fmt.Println("demo") demo := true _, _ = iio.EOF, demo } func demo() (int, int) { return 1, 2 } func _() { _, _ = iio.EOF, demo fmt := "demo" iio := 1 _, _ = iio, fmt a, _ := demo() _ = a }

Variable names fmt and iio clash with names of import packages. Not to confuse them later in code, it is better to rename these variables.

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.

GoImportUsedAsName
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 | Probable bugs

Inspection ID: GoImportUsedAsName

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 GoImportUsedAsName

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