Forgetting that a function returns an error:
...
foo() // foo returns an error that isn't being handled.
...
Forgetting to check the error returned by a function. Note a linter won't pick this up since the err variable is used later. ...
err := foo()
err = bar() // The previous error will go unhandled.
...
Accidentally typing return nil instead of return err: ...
if err != nil {
return nil
}
...
And in the case of the errors library, there's times where I will call a builtin function that returns an error and forget to call errors.WithStack. Every once in a while I'll come across an error without a stack trace and I'll have to hunt down where it came from: ...
err := json.Unmarshal(bytes, &obj)
if err != nil {
return err // should be errors.WithStack(err)
}
...
All of these issues look just like normal bug free Go code. On the basis that I've introduced more bugs this way, I prefer Python style error handling by far.