go-mnd icon indicating copy to clipboard operation
go-mnd copied to clipboard

Multiplicating two numbers and a duration is not reported

Open Crocmagnon opened this issue 1 year ago • 1 comments

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.

Crocmagnon avatar Sep 09 '23 07:09 Crocmagnon

Hi,.. I agree with you that multiplying with a duration means that is a clear number, so maybe reporting none would be preferable

hendrywiranto avatar Jan 03 '24 16:01 hendrywiranto