Inspectopedia 2025.2 Help

Exported element should have its own declaration

Reports exported variables or constants in comma-separated lists of declarations.

Example:

const C1, C3, C2, C44, C9, C11, C6 = 1, 2, 3, 1, 3, 2, 1

This declaration makes it hard to understand what value each constant has. You can apply the Extract to own declaration quick-fix to make this declaration more readable. After the quick-fix is applied to each constant, the declaration looks as follows:

const ( C3 = 2 C2 = 3 C44 = 1 C9 = 3 C11 = 2 C6 = 1 C1 = 1 )

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.

GoExportedOwnDeclaration
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 | Code style issues

Inspection ID: GoExportedOwnDeclaration

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 GoExportedOwnDeclaration

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