Accidental nanoseconds
ainar-g opened this issue · 3 comments
ainar-g commented
The classic:
c := &Config{
// …
// Whoops! TTL has the type time.Duration.
// Wanted sixty seconds, got sixty nanoseconds!
TTL: 60,
}
I'm pretty sure that 95 % of such raw time.Duration
assignments are errors, since not a lot of people actually deal with nanosecond precision in Go.
dgryski commented
I thought staticcheck caught these?
ainar-g commented
Not yet, although there is an issue about it. See dominikh/go-tools#222.
dominikh commented
Staticcheck currently only catches time.Sleep calls: https://staticcheck.io/docs/checks/#SA1004