Yeah, I now, but considering these proposal: https://github.com/golang/go/issues/20757 This function (IsZero) would not bring even more reliable use ?
Em quinta-feira, 20 de julho de 2017 22:12:04 UTC+2, Ian Lance Taylor escreveu: > > On Thu, Jul 20, 2017 at 1:02 PM, Helton Marques <helto...@gmail.com > <javascript:>> 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.