golang errors (after 1.13)

Since go 1.13, go has gone one step further in terms of error handling. Errors can be wrapped, bubbled up and act upon. We will here take a step back on error handling in go, from the perspective of a library. What data could we have in the error? Inspired by a rust talk from Jan Lusby about errors, here are a few things that error could contain: The reason of the error Context of the error: struct field, struct surrounding values… Stack trace: which part of the code triggered this error How to fix the error: suggest a way to fix it Where are errors displayed?...

May 17, 2021 · 5 min · Me