Skip to content
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

Starting v2 #19

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Starting v2 #19

merged 3 commits into from
Jan 7, 2025

Conversation

m-mizutani
Copy link
Owner

This PR is base of version 2 of goerr

Motivation of v2

The goerr package previously utilized the With method to attach contextual information to errors. However, over time, several issues have been identified with this approach:

  • It is unclear whether the method performs a destructive change on the original object.
  • Actually, it does perform destructive changes, resulting in an error object that is not immutable.
  • The implementation of a tagging feature led to the creation of a separate method, WithTags, which lacks consistency with the With method. This inconsistency may lead to similar issues when adding new features in the future.

To address these concerns, the goal of this pull request (PR) is to implement the functionality for attaching parameters to errors using the functional options pattern. This approach will make it more explicit that the generated error objects are immutable.

This change breaks backward compatibility, then I decided to start it as version 2.

@m-mizutani m-mizutani merged commit 7d75169 into main Jan 7, 2025
5 checks passed
@m-mizutani m-mizutani deleted the new/v2 branch January 7, 2025 23:42
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.

1 participant