-
-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Labels
needs-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenew-check
Description
I have seen a lot of code creating errors like fmt.Errorf("something went wrong")
instead of errors.New("something went wrong")
. Not only is the latter faster, but I also think that a lot of the former cases are wrong in subtle ways. If you use fmt.Errorf
with a single string and no formatting verbs, you either forgot to add formatting (kind of related to #1528, I guess) or you should have used a regular error instead. As such, I think it be flagged as a problem and suggest replacing the call. In the case where you don't want to wrap or format anything, I also think it is a lot clearer to see a regular errors.New()
as I can easily know that it is a static error string.
Metadata
Metadata
Assignees
Labels
needs-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenew-check