-
Notifications
You must be signed in to change notification settings - Fork 2
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
Do not use errgo nor pkg/errors for root errors, matches stdlib #584
base: master
Are you sure you want to change the base?
Conversation
7664a77
to
d310f9d
Compare
// New wraps errors.New from the pkg/errors library | ||
// | ||
// These errors are usually created outside any function code at the top of | ||
// files, so no context is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I would keep a first line of comment explaining what this function do.
// New wraps errors.New from the pkg/errors library | |
// | |
// These errors are usually created outside any function code at the top of | |
// files, so no context is needed. | |
// New returns an error that formats as the given text. | |
// New wraps errors.New from the pkg/errors library | |
// | |
// These errors are usually created outside any function code at the top of | |
// files, so no context is needed. |
} | ||
|
||
func Errorf(ctx context.Context, format string, args ...interface{}) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both Newf
and Errorf
? correct me if I'm wrong but they seem identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right it was to prevent breaking the API more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hence should we mark one of these two methods as deprecated?
Co-authored-by: Étienne M. <[email protected]>
Co-authored-by: Étienne M. <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one remaining question. Already approving whatever the answer
} | ||
|
||
func Errorf(ctx context.Context, format string, args ...interface{}) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hence should we mark one of these two methods as deprecated?
Expose
New
to create simple string errors, wrapping pkg/errors.NewExpose NewWithContext/Newf/Errorf, to create errors which are not wrapping others
Related to #582