3 ms·
Every time you use `fmt.Errorf` and `if err != nil { return nil, err }`, you're returning a stringly typed error up the stack. The entire stdlib does this. An
by TheDong 7y ago
Every time you use `fmt.Errorf` and `if err != nil { return nil, err }`, you're returning a stringly typed error up the stack.
The entire stdlib does this. An error stack is never present from stdlib functions' errors, and third party libraries I see it just as infrequently.
If only novice go devs do that, than the entire go core team are novices, as well as the authors of popular go projects like kubernetes and docker.
- skybrian 7y ago"Stringly typed" means literally a string. Go doesn't always distinguish between errors, but the error type does distinguish errors from non-errors and that's important. It seems better to have coarse-grained types than to standardize the wrong type hierarchy?