You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for creating/maintaining this tool. Very useful!
Short summary
When declaring a literal const or var with a type conversion in a block, mnd detects the argument of the type conversion as a magic number. This happens only when type conversions are used in block declarations: inline/standalone declarations don't trip up the detection.
Steps to reproduce the behavior
In main.go:
package main
// Could also be `var`.const (
// FooBlockLiteral is okay.FooBlockLiteral=512// FooBlockTypeConversion trips up mnd://// Magic number: 512, in <argument> detectedFooBlockTypeConversion=int64(512)
)
// FooLiteral is okay.constFooLiteral=512// FooTypeConversion is also okay.constFooTypeConversion=int64(512)
In go.mod:
module mnd-test
go 1.16
Then:
$ mnd .
/path/to/mnd-test/main.go:9:33: Magic number: 512, in <argument> detected
go-mnd version or commit ref
v2.3.1
Go version (output of 'go version')
go version go1.16.2 linux/amd64
Operating system / Environment
Debian 10.
Expected behavior
No/clean output from mnd:
$ mnd .
Actual behavior
See the error in the reproduction steps.
The text was updated successfully, but these errors were encountered:
Thank you for creating/maintaining this tool. Very useful!
Short summary
When declaring a literal const or var with a type conversion in a block, mnd detects the argument of the type conversion as a magic number. This happens only when type conversions are used in block declarations: inline/standalone declarations don't trip up the detection.
Steps to reproduce the behavior
In
main.go
:In
go.mod
:Then:
go-mnd version or commit ref
v2.3.1
Go version (output of 'go version')
Operating system / Environment
Debian 10.
Expected behavior
No/clean output from
mnd
:Actual behavior
See the error in the reproduction steps.
The text was updated successfully, but these errors were encountered: