Is this a bug, a false positive, or a gap in my understanding?
metaleap opened this issue ยท 4 comments
For watcher-default.go#L45, unconvert -v github.com/metaleap/go-util-fs
reports:
/home/me/c/go/src/github.com/metaleap/go-util-fs/watcher-default.go:45:33: unnecessary conversion
me.DebounceNano = time.Duration(250 * time.Millisecond).Nanoseconds()
^
I don't see any conversions anywhere near?!
Same result with -safe
, except prepended by line:
... huh, *ast.SelectorExpr at /home/me/c/go/src/github.com/metaleap/go-util-fs/watcher-default.go:45:20
I don't see any conversions anywhere near?!
I believe there is an unnecessary conversion of 250 * time.Millisecond
, which has type time.Duration
, to time.Duration
, right here:
time.Duration(250 * time.Millisecond)
The conversion can be removed, simplifying that line to:
me.DebounceNano = (250 * time.Millisecond).Nanoseconds()
See playground sample.
Ahh! That would be it I guess! I assumed (for no good reason) that this tool would only look for foo.(bar)
syntax
I assumed (for no good reason) that this tool would only look for foo.(bar) syntax
But that's not a conversion.
Eeeek, excuse me guys for being slow and mixing up terms after some 4+ years outside golang land ๐ yes, casts vs conversions are a substantial difference, I've spent too much time in languages confusing/hiding both under the hood or with no concept of casts whatsoever.....