-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
refactor!: Do not capitalize error strings #3446
refactor!: Do not capitalize error strings #3446
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3446 +/- ##
=======================================
Coverage 92.26% 92.26%
=======================================
Files 174 174
Lines 15023 15023
=======================================
Hits 13861 13861
Misses 1068 1068
Partials 94 94 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @alexandear.
Although this is not technically a breaking change in the sense that older code will not compile correctly, if users of the package parse error strings (which they should NOT), then it would silently break them if we didn't call it out.
So as a user of this library, I would much rather know about a potential breakage to my code than to let this silently slip by unnoticed.
Therefore, let's be pedantic and call this out as "breaking" so it is visible.
Also, we have a bunch of other breaking API changes upcoming in the next major release, so now is as good a time as any to make these changes.
And just for the record, this is one of my LEAST favorite lint requirements and rules about idiomatic Go, because in a big code base, I like to see which function is returning the error message and I want to put the function's name into the error which sometimes starts with a capital. Ah well, I understand about the wrapping of errors and why it was done this way, yet still it can be my least favorite thing about Go.
Also for the record, Go is still my favorite programming language and the one I reach for when starting a new serious project or a quick script, but MoonBit is quickly shaping up to be a strong contender. 😂
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
@stevehipwell - might you have time for a code review? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you, @stevehipwell ! |
BREAKING CHANGE: Some error strings are slightly modified - please do not rely on error text in general.
This PR is somewhat of a breaking change because it changes error messages for
Client.NewRequest
,Client.NewFormRequest
, andClient.NewUploadRequest
. However, I'm not sure if anyone relies on the word case of an error message.The PR also configures golangci-lint to detect this in the future.
revive.error-strings
was already enabled in the lint config but didn't work until we setconfidence: 0.6
in this PR.