iotyper

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

README

iotyper

A static analysis tool for Go that detects iota usage without explicit type specification.

Overview

iotyper is a golangci-lint plugin that ensures iota constants have explicit types to improve code clarity and type safety.

Usage

What Gets Flagged

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
)
How to Fix

Add an explicit type to your iota declaration:

// ✅ Good: type explicitly specified
const (
    StatusPending int = iota
    StatusActive
    StatusClosed
)
Suppressing False Positives

You can suppress the linter using //nolint comments:

const (
    Value1 = iota  //nolint:iotyper
    Value2 = iota  //nolint:all
)

License

See LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: name,
	Doc:  doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
iotyper-lint command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL