-
Notifications
You must be signed in to change notification settings - Fork 354
Update error message handling #357
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
Conversation
d7ba833 to
ac44f90
Compare
|
I guess with go1.16 on the horizon, we can do this now. |
beorn7
left a comment
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.
I sense a somewhat inconsistent use of %s vs %q. Before adding a million comments, perhaps you should first tell us what the intention is.
f048905 to
2b31529
Compare
|
Updated with some |
|
So the guideline is to quote if in doubt? I'll make a pass following that guideline. |
beorn7
left a comment
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.
OK, I have found a number of more instances that I believe should be %q.
In summary, I wholeheartedly agree that potentially unknown or misformatted strings in the middle of an error message should be quoted. I'm way more relaxed about anything after a colon, after which you only have a blank and then said string. But I can see the argument for using %q there, too, especially if the string might contain line breaks or tabs.
|
And to be clear: I have reviewed now with the assumption that we only ever want to use |
|
@beorn7 Yes, that seems like a reasonable policy, thanks for the great reviewing. |
b825ab5 to
346f28a
Compare
discordianfish
left a comment
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.
Awesome!
|
@beorn7 Ok, I think I've got it cleaned up. PTAL. |
beorn7
left a comment
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.
I found a few more. 🦆
Use Go 1.13 `%w` error formatting
* Update minimum Go version to 1.13.
* Bump vendoring.
* Update all error format strings to use %w.
* Cleanup consistency of use.
* Cleanup use of `errors.New("string" + var)` to use `fmt.Errorf()`.
#310
Signed-off-by: Ben Kochie <superq@gmail.com>
346f28a to
67a72b2
Compare
beorn7
left a comment
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.
\o/ The world is a better place now!
Update error message handling
Use Go 1.13
%werror formattingerrors.New("string" + var)to usefmt.Errorf().#310
Signed-off-by: Ben Kochie superq@gmail.com