Represent timeouts using time.Duration
Representing these constants in time.Duration
form is more semantic, and allows rewriting
if time.Since(start).Seconds() > myTimeout {
as
if time.Since(start) > myTimeout {
One side effect is that Printf
formatting renders a time.Duration
as a string like 10s
or 100ms
, which changes some log messages slightly. If we need compatibility of log message formats, we could use .Seconds()
in those places.