blah, err := foo(...)
if err != nil {
return nil, err
}
and it's sister: blah, err := foo(wibble)
if err != nil {
return nil, errors.New("foo error with blah due to: " + wibble)
}
After a while I got to like passing errors carefully back up the call stack , cleaning them up, rewriting them and making them more useful.My Go programs have far better (more detailed & relevant) error messages than any of my other code.