Skip to content

go1.26: replace errors.New with fmt.Errorf #8543

@aarongable

Description

@aarongable

It used to be the case that errors.New was more efficient than fmt.Errorf, and therefore folks said that you should use errors.New any time you were creating an error and didn't need any formatting capabilities. That is no longer the case, so we should switch to using fmt.Errorf everywhere for the sake of consistency and lower mental overhead.

Read more: https://antonz.org/go-1-26/#fmt-errorf, https://go-review.googlesource.com/c/go/+/708836

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions