The cost of Go's panic and recover

TL;DR ¶ Some of the wisdom contained in Josh Bloch&rsquo;s Effective Java book is relevant to Go. panic and recover are best reserved for exceptional circumstances. Reliance on panic and recover can noticeably slow down execution, incurs heap allocations, and precludes inlining. Internal handling of failure cases via panic and recover is tolerable and sometimes beneficial. Abusing Java exceptions…