Init seems very harsh, how can you ensure proper configuration then? Otherwise I don't mind oanics during object creation or explicit initialization. Panics in mid execution less so but parhaps there are cases where it is warranted.
ons 31 maj 2017 kl 21:25 skrev Peter Kleiweg <pklei...@xs4all.nl>: > 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. > -- 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.