Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplicating two numbers and a duration is not reported #36

Open
Crocmagnon opened this issue Sep 9, 2023 · 1 comment
Open

Multiplicating two numbers and a duration is not reported #36

Crocmagnon opened this issue Sep 9, 2023 · 1 comment

Comments

@Crocmagnon
Copy link

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.

@hendrywiranto
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants