understood the same, was going to give same example. panic at init is ok to me while it look likes a compile error a system requirement error
On Wednesday, May 31, 2017 at 9:41:37 PM UTC+2, Pierre Durand wrote: > > I use these functions in init(): > https://golang.org/pkg/html/template/#Must > https://golang.org/pkg/regexp/#MustCompile > > Le mercredi 31 mai 2017 21:24:58 UTC+2, Peter Kleiweg a écrit : >> >> If a package can't be used because some precondition can't be fulfilled, >> you can use a panic. Then the whole program will crash at start-up. >> >> The alternative would be to not panic in the init, but have all function >> calls return an error. If the package is used in a large program, part of >> it may still be functional. >> >> Using panic in an init function of a package, do or don't? >> >> -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
