Skip to content

partially-typed-constant-group

Detect constant groups where only the first explicit value has a type.

Updated View as Markdown

Default severity: warning

In a constant group, an explicit type is inherited only when a later declaration omits its value. If every declaration has an explicit literal but only the first has a type, later constants silently use default built-in types and may lose methods or assignment compatibility.

Bad

const ( first Kind = 1; second = 2 )

Good

const ( first Kind = 1; second Kind = 2 )
Navigation

Type to search…

↑↓ navigate↵ selectEsc close