On Thu, Jul 20, 2017 at 1:02 PM, Helton Marques <helton.m...@gmail.com> wrote:
>
> There's some reason to not have the function `IsZero` to time.Duration ?
>
> IMO, I think this can be useful:
>
>
> ```
> type Server struct { timeout time.Duration `yaml:"timeout:"` }
> ...
> if srv.timeout.IsZero() { srv.timeout = defaultServerTimeout }
> ```
>
> Anyone knows if there's some restriction to not have IsZero() bool functions
> to defined types as int64 ?

Where you want to write `d.IsZero()`, you can just write `d == 0`.
I'm not sure adding a `IsZero` method is really worth it.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to