Okay, so surely some syntactic sugar could make it more pleasant than the
if (err != nil) {
return nil, err
}
repeated boilerplate. Like, if that return is a tagged union you could do some kind of pattern matching?... oh, Go doesn't have sum-types. Or pattern matching.
Could you at least do some kind of generic error handler so I can call
y := Handle(MyFuncThatCanReturnError(x))
?... Okay, GoLang does not have tuples. Multiple returns must be handled separately.
Okay could I write some kind of higher-order function that handles it in a generic way? Like
y := InvokeWithErrorHandler(MyFuncThatCanReturnError, x)
?No? That's not an option either?
... why do you all do this to yourselves?