Can We Panic Yet? Error Handling in Go

Raphael 'kena' Poss at Go Systems Conf SF 2020

Golang’s “one-size-fits-all” error handling is not a panacea. Alternatives provide good performance, and perhaps more surprisingly, are actually cheaper from a software engineering perspective.

In this talk, Raphael dives into the Go calling convention and quantify experimentally the mandatory performance overhead of Go’s return value handling, as well as that of handling Go’s panics, a variant of exceptions found in other languages. There is a surprising inflection point with regard to performance between error returns and panic-based exceptions to signal errors, which challenges the programming idioms recommended by the Go team. In fact, we will see how panic-based exceptions can not only improve performance, but generally improve code quality and reduce software engineering costs. These insights will be illustrated through the software patterns found in a major open source project written in Go, CockroachDB.