4 ms·
It’s pretty easy to write your own Errorf() wrapper or some sort of WithStack() that stores runtime/debug.Stack() output. github.com/pkg/errors offers more flex
by oefrha 3y ago
It’s pretty easy to write your own Errorf() wrapper or some sort of WithStack() that stores runtime/debug.Stack() output. github.com/pkg/errors offers more flexibility in formatting though.
- Groxx 3y agoWell, sure, but by that metric this library is even easier to build yourself since it's only gathering a single stack entry per wrap. And it has no backwards compatibility to worry about. "You can build X by hand too" has little to do with why people choose to create or use libraries.
- healsdata 3y ago> "You can build X by hand too" has little to do with why people choose to create or use libraries. In my experience, "you can build X by hand" is the Go community's preferred approach.
- tubthumper8 3y agoIt's been said that "Go" stands for "Go implement it yourself"
- arp242 3y agoMy implementation is about 120 lines, plus about 100 lines of tests. It's not hard, but not trivial either. Doing that for every single project is rather tedious. Especially for prototyping I just quickly want something that 'just works' without fuss.