-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: drop github.com/pkg/errors as a dependency #73
Comments
SGTM.
Here are some stats:
$ cd $GOPATH/src/github.com/llir/llvm
$ ag --nofilename --nobreak -o --ignore testdata "errors\.\w+" \
| sort \
| uniq -c
93 errors.Errorf
3 errors.New
495 errors.WithStack
1 errors.Wrapf
|
For added context, I do find the So, rather than just removing the use of |
Marking this as a future milestone until the error handling story of Go has been fully unwrapped. As of 2019-06-30, https://blog.golang.org/go2-next-steps states that stack-trace information will not enter Go 1.13. Therefore, we will wait at least until Go 1.14 before replacing |
@mewmew any updates here? since Go 1.14 has passed for a long time XD |
Do you know if the standard library error handling provides stack traces for errors in a good way? This is the reason we keep using |
Shameless plug: you can switch it to drop-in replacement |
Hi @mitar, Thanks for making us aware of your fork of the The main idea with this issue (as outlined by @pwaller in #73 (comment)) was to reduce the need of external dependencies in That being said, it's definitely good to know that the Cheers, |
Thank you for the reply. From my experience writing a library, it is tricky to have your own stack traces because how fragmented is support for stack traces among different libraries. So not sure how reasonable is to roll your own solution if you do want stack traces yourself. Besides just recording stack traces, formatting, and JSON serialization of stack traces, there is also interoperability with other packages. If some of your dependencies use a different way to record a stack trace, it is useful to be able to extract and reuse that stack trace (instead of storing your own, shorter stack trace at the point you call into that library). BTW, my package is not fork of Anyway, I just wanted to bring the package to your radar and clarify these two points. I otherwise completely understand that minimizing dependencies is important. We were doing the same but then decided to open source errors package once |
I can imagine that dealing with stack traces may be difficulty, especially in a cross-platform and standardized manner. I'm certain that we won't be "rolling our own" implementation for handling stack traces. So either we'll rely on external libraries to handle tracking of stack traces, use the Go standard library for it (once/if such support is added for error stack traces) or simply remove the use of stack traces to avoid external dependencies. As you can see from the creation time of this issue, the ball has not been moving since the situation as is is "good enough". Should we start running into concrete issues with
Sorry for the misunderstanding on my part. Good to know that
Thanks @mitar for sharing your work with the open source community. Definitely appreciate it! On a related note, have you seen the capslock tool? It can be used for static analysis of dependencies to determine what capabilities they use. A very handy tool, even though it's still in some early alpha stage. Happy coding! Cheers, |
@mewmew and I had a brief thought about reducing external dependencies. This is a reminder to discuss this further.
We're currently thinking that pkg/errors doesn't bring much to the table and we can drop it. Dropping it should be fairly transparent to any users. Part of the motivation is to reduce dependencies, and the other part is from the readme of pkg/errors:
References:
The text was updated successfully, but these errors were encountered: