go-mnd
go-mnd copied to clipboard
Multiplicating two numbers and a duration is not reported
Short summary
package main
import (
"log"
"time"
)
func main() {
log.Println(24 * time.Hour) // reported
log.Println(1 * 24 * time.Hour) // not reported
}
Steps to reproduce the behavior
(See above)
go-mnd version or commit ref
Running as part of golangci-lint
:
$ golangci-lint --version
golangci-lint has version 1.54.2 built with go1.21.0 from 411e0bbb on 2023-08-21T12:04:32Z
Go version (output of 'go version')
$ go version
go version go1.21.1 darwin/arm64
Operating system / Environment
macOS 13.5.2 (22G91)
Expected behavior
Consistency: either both are reported because they're both magic numbers, or none are reported because when multiplied with a Duration the meaning is clear.
Actual behavior
Only one of the lines is reported: the one with only one number multiplied with a Duration.
Hi,.. I agree with you that multiplying with a duration means that is a clear number, so maybe reporting none would be preferable