Conversation
|
Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message. |
mislav
left a comment
There was a problem hiding this comment.
Looks great!
I don't have strong opinions about FlagErrorWrap also being available. Would FlagErrorf("%w", err) be a functional equivalent to the wrap function?
No, because fmt.Errorf("%w", err) is not the identity function. (I had had the same question.) I was initially inclined not to add the wrap function, but concluded that it is consistent with the abstraction. We already expose the concept of "the underlying error" through Unwrap; FlagErrorf("%w", err) doesn't let you control it. |
This change hides the representation of FlagError, exposing two constructors:
Do we need the second one? Note that calling it instead of FlagErrorf("%s", err) is a behavior change.