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

False positive when multiplying against an untyped int constant, again #9

Closed
bconway opened this issue Feb 19, 2021 · 0 comments · Fixed by #10
Closed

False positive when multiplying against an untyped int constant, again #9

bconway opened this issue Feb 19, 2021 · 0 comments · Fixed by #10

Comments

@bconway
Copy link

bconway commented Feb 19, 2021

I picked up this linter in the latest golangci-lint release (includes 0.0.3) and am trying with the latest 0.0.4 version as well. I am still seeing the previously-resolved false positive. The only difference I can think of might be because my constant is in a different package?

package session:

const TokenExp = 10 * 60

package service (test file):

require.WithinDuration(t, time.Now().Add(session.TokenExp*time.Second), loginResp.ExpiresAt.AsTime(),
2*time.Second)

Result:

$ durationcheck ./...
.../session_test.go:54:4: Multiplication of durations: `session.TokenExp * time.Second`
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

Successfully merging a pull request may close this issue.

1 participant