3 ms·
When writing quick-and-dirty Go programs, I define a function called "bailif" (pun intended) that turns non-nil errors into panics. i.e. `func bailif() { if err
by dantillberg 6y ago
When writing quick-and-dirty Go programs, I define a function called "bailif" (pun intended) that turns non-nil errors into panics. i.e. `func bailif() { if err != nil { panic(err) } }`. Each error can be "handled" at first by just `bailif(err)`.
- euroderf 6y agoThis works best in main(), while library functions can just return errors upwards to it.