go-mnd - Magic number detector for Golang
A vet analyzer to detect magic numbers.
What is a magic number?
A magic number is a numeric literal that is not defined as a constant, but which may change, and therefore can be hard to update. It's considered a bad programming practice to use numbers directly in any source code without an explanation. It makes programs harder to read, understand, and maintain.
Project status

Install
This analyzer requires Golang in version >= 1.12 because it's depends on the go/analysis API.
go get github.com/tommy-muehle/go-mnd/cmd/mnd
Usage

go vet -vettool $(which mnd) ./...
or directly
mnd ./...
The -checks
option let's you define a comma separated list of checks.
Checks
By default this detector analyses arguments, assigns, cases, conditions, operations and return statements.
t := http.StatusText(200)
c := &http.Client{
Timeout: 5 * time.Second,
}
switch x {
case 3:
}
if x > 7 {
}
var x, y int
y = 10 * x
return 3
Notices
By default the number 0 is excluded!
License
The MIT License (MIT). Please see LICENSE for more information.