Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is base of version 2 of
goerr
Motivation of v2
The
goerr
package previously utilized theWith
method to attach contextual information to errors. However, over time, several issues have been identified with this approach:WithTags
, which lacks consistency with theWith
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.