A static analysis tool for Go that detects iota usage without explicit type specification.
iotyper is a golangci-lint plugin that ensures iota constants have explicit types to improve code clarity and type safety.
iotyper reports when iota is used in const declarations without an explicit type:
// ❌ Bad: will be flagged
const (
StatusPending = iota // Error: iota used without type specification
StatusActive
StatusClosed
)Add an explicit type to your iota declaration:
// ✅ Good: type explicitly specified
const (
StatusPending int = iota
StatusActive
StatusClosed
)You can suppress the linter using //nolint comments:
const (
Value1 = iota //nolint:iotyper
Value2 = iota //nolint:all
)See LICENSE file for details.