refactor: replace pkg/errors with standard errors package#2658
refactor: replace pkg/errors with standard errors package#2658space-aditya wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Signed-off-by: Aditya <jaiswal.aditya.deelip@gmail.com> Signed-off-by: Aditya <jaiswal.aditya.deelip@gmail.com>
|
@microsoft-github-policy-service agree |
|
Hey @jterry75, @dcantah @helsaawy! I was working on a package deprecation for https://github.com/containerd/containerd this is a first in a series of PRs i want to raise for the same. Thank you. |
|
@anmaxvl @thaJeztah could you help with this please
|
| // TODO: update implementation to use go1.13 style errors with `errors.As` and co. | ||
|
|
||
| // StackTracer is an interface originating (but not exported) from the | ||
| // github.com/pkg/errors package. It defines something which can return a stack | ||
| // trace. | ||
| type StackTracer interface { | ||
| StackTrace() errors.StackTrace | ||
| } | ||
|
|
||
| // BaseStackTrace gets the earliest errors.StackTrace in the given error's cause | ||
| // stack. This will be the stack trace which reaches closest to the error's | ||
| // actual origin. It returns nil if no stack trace is found in the cause stack. | ||
| func BaseStackTrace(e error) errors.StackTrace { |
There was a problem hiding this comment.
FWIW; this means we'd lose the stack-traces?
Probably relevant for this context; while in many cases stdlib will work, there's situations where it doesn't provide the same functionality; we recently got communication open with the pkg/ folks, and the pkg/errors repository has been un-archived so that it can be used for situations where stdlib is not sufficient;
cc @tonistiigi
There was a problem hiding this comment.
stack traces won't be lost, it can be retrieved with the runtime/debug, debug.Stack() method.
but yes, that would require a middleware or manual changes
There was a problem hiding this comment.
on the positive side, this would also mean that only panic'able errors should occur, atleast that's what i see emerging as a pattern out of this
There was a problem hiding this comment.
Maybe @tonistiigi can provide more context; I know that BuildKit is a heavy user of pkg/errors (and stdlib errors didn't fit the bill there), but I don't know the full context where stdlib lacked the features needed.
No description provided.