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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.