Skip to content

Fix #70: Use %w formatting directives when fmt.Error'ing an error. #71

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

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

constantoine
Copy link
Contributor

@constantoine constantoine commented Jun 4, 2025

As explained in #70, not using %w formatting directive in some places makes it non-trivial for the user to make use of the error in a meaningful way (errors.Is or errors.As), outside of string matching. This is particularly painful for errors returned by custom type's XXXUnmarshaler

This PR aims to change the remaining fmt.Errorf calls where %w directive isn't used but an error is passed while adding no new code.

Signed-off-by: Cléo Rebert <cleo.rebert@ovhcloud.com>
@constantoine constantoine requested a review from a team as a code owner June 4, 2025 12:38
@constantoine
Copy link
Contributor Author

Hi @jamietanna I hope the ping is not inappropriate :)

Do those changes (as well as the rationale behind them) sound acceptable to you?

@jamietanna
Copy link
Member

jamietanna commented Jun 17, 2025

Pings are not recommended 😅

I have seen this and I do agree with it, thanks for fixing it!

I hadn't got round to replying here, and would like to merge this alongside some other runtime changes, but my focus recently has been trying to get oapi-codegen itself ready for a release, which is slow work 🙃

Will try to get to this soon!

Copy link
Member

@jamietanna jamietanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jamietanna jamietanna merged commit 0f4916e into oapi-codegen:main Jul 15, 2025
14 checks passed
@jamietanna jamietanna added the bug Something isn't working label Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants