-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The package github.com/Scalingo/go-utils/errors/v2 makes use of the package github.com/pkg/errors so that we can call functions like errors.Wrap in the errctx.go file.
Uses of this package are:
Lines 28 to 30 in 5863c81
| func New(ctx context.Context, message string) error { | |
| return ErrCtx{ctx: ctx, err: errors.New(message)} | |
| } |
Lines 41 to 43 in 5863c81
| func Wrap(ctx context.Context, err error, message string) error { | |
| return ErrCtx{ctx: ctx, err: errors.Wrap(err, message)} | |
| } |
Lines 49 to 51 in 5863c81
| func Errorf(ctx context.Context, format string, args ...interface{}) error { | |
| return ErrCtx{ctx: ctx, err: errors.Errorf(format, args...)} | |
| } |
The package github.com/pkg/errors is not part of the standard library. It was widely used in the Go community before Go 1.13 because there were no error wrapping mechanism in the standard library. Go 1.13 introduced a wrapping mechanism with the addition of %w in fmt.Errorf.
Hence I would be in favor of removing the using of this non-standard package to solely rely on the standard library for wrapping purpose.