Skip to content

chore: replace golang.org/x/xerrors for stdlib errors#763

Merged
zeroshade merged 2 commits intoapache:mainfrom
thaJeztah:stdlib_errors
Apr 13, 2026
Merged

chore: replace golang.org/x/xerrors for stdlib errors#763
zeroshade merged 2 commits intoapache:mainfrom
thaJeztah:stdlib_errors

Conversation

@thaJeztah
Copy link
Copy Markdown
Contributor

relates to:

The golang.org/x/xerrors module is a transitional module for what became go1.13 errors. Most of its functionality is now available in stdlib errors, with the exception of stdlib not providing a stack-trace (and some utility functions related to that).

Looking at history to see if that functionality was essential for using this package, I found that the golang.org/x/errors module was introduced in apache/arrow@7126fdb, to address ARROW-7357.

we should migrate away from pkg/errors to golang.org/x/xerrors to
ensure better error handling (and one that is Go-1.13 compatible).

Based on the above, it looks like the intent was to provide compatibility with go1.13+ errors, which are now mainline, so stdlib errors should be preferred for this.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@thaJeztah thaJeztah requested a review from zeroshade as a code owner April 13, 2026 07:57
@zeroshade
Copy link
Copy Markdown
Member

Can you run pre-commit and fix the linting issues?

@thaJeztah
Copy link
Copy Markdown
Contributor Author

Doh! I saw some of those errors having punctuation, but thought I'd leave them as they were already there and to keep scope minimal, but forgot that linters tend to ignore them for xerrors but will flag them for stdlib 😂

I'll have a look at fixing the linting issues.

The golang.org/x/xerrors module is a transitional module for what became
go1.13 errors. Most of its functionality is now available in stdlib errors,
with the exception of stdlib not providing a stack-trace (and some utility
functions related to that).

Looking at history to see if that functionality was essential for using
this package, I found that the golang.org/x/errors module was introduced
in [apache/arrow@7126fdb], to address [ARROW-7357].

> we should migrate away from `pkg/errors` to `golang.org/x/xerrors` to
> ensure better error handling (and one that is Go-1.13 compatible).

Based on the above, it looks like the intent was to provide compatibility
with go1.13+ errors, which are now mainline, so stdlib errors should be
preferred for this.

[ARROW-7357]: https://issues.apache.org/jira/browse/ARROW-7357
[apache/arrow@7126fdb]: apache/arrow@7126fdb

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Copy Markdown
Contributor Author

I think it should be good now 👍

@zeroshade zeroshade merged commit 1769405 into apache:main Apr 13, 2026
@thaJeztah thaJeztah deleted the stdlib_errors branch April 13, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants