4 ms·
I stronlgy dislike Go's error handling. It is incredibly annoying to add if err != nil { <do stuff> } after nearly every function call and to have a
by BadBadJellyBean 2y ago
I stronlgy dislike Go's error handling. It is incredibly annoying to add
if err != nil {
<do stuff>
}
after nearly every function call and to have a error as a secondary return type. At least for me it is clunky and annoying and incredibly distracting. If there was at least some syntactic sugar around this I could probably live with it but like this I just don't like using Go.
- zeroc8 2y agoThis works for me. if res, err := doSomething(); err == nil { return nil, err } no point in continuing with a null object anyway
- aleksiy123 2y agoIn google c++ there are two macros which I feel make it look a lot nicer. ASSIGN_AND_RETURN(auto var, status_or); And RETURN_IF_ERROR(status); Which are just more ergonomic with the drawback of being macros.