https://github.com/cyberagent/iotyper-lint
https://github.com/cyberagent/iotyper-lint
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cyberagent/iotyper-lint
- Owner: CyberAgent
- License: apache-2.0
- Created: 2025-05-22T06:17:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-27T03:15:34.000Z (7 months ago)
- Last Synced: 2025-11-29T06:30:13.786Z (7 months ago)
- Language: Go
- Size: 46.9 KB
- Stars: 4
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
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:
```go
// ❌ 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:
```go
// ✅ Good: type explicitly specified
const (
StatusPending int = iota
StatusActive
StatusClosed
)
```
### Suppressing False Positives
You can suppress the linter using `//nolint` comments:
```go
const (
Value1 = iota //nolint:iotyper
Value2 = iota //nolint:all
)
```
## License
See [LICENSE](LICENSE) file for details.