Most of the programming languages support multiple ways of handling errors, for example try-catching, value-checking, popping errors in the stack. Learning go I found the approach of this language is way different: you can let a function return an error (and eventual result(s)), thus not throwing any kind of error, and not returning “special values” like, for example, PHP’s
json_decode (which can return
stdClass or even an
In this article I’ll describe what I found being (for me) the most elegant and convenient way of handling errors in Go.