Skip to content

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

@bconway

Description

@bconway

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions