-
-
Notifications
You must be signed in to change notification settings - Fork 422
[skip changelog] Remove spurious argument from error message #1827
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
`github.com/arduino/arduino-cli/i18n.Tr` provides a `fmt.Printf`-style interface, where the first argument may serve as a template filled by subsequent arguments according to its format verbs. This call contains a subsequent argument, but no verb in the format string to use it. This generates some cryptic content in the error message. For example: Error during install: Error downloading tool arduino:bossac@1.7.0-arduino3: no versions available for the current OS%!(EXTRA *cores.ToolRelease=arduino:bossac@1.7.0-arduino3) The tool name is already provided in the correctly configured `Message` field of the error, so there is no need to include it in the `Cause` field as well, so the spurious argument can be removed entirely rather than the alternative fix of adjusting the format string argument. I suspect the spurious argument was simply the result of a copy/paste error.
Codecov Report
@@ Coverage Diff @@ ## master #1827 +/- ## ======================================= Coverage 35.86% 35.86% ======================================= Files 231 231 Lines 19324 19324 ======================================= Hits 6930 6930 Misses 11569 11569 Partials 825 825
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I think that there is a way to let golint to detect this kind of errors (i.e. tell the linter that tr
is a printf
style function and check that the arguments match the format string), but I never investigated how.
Uh oh!
There was an error while loading. Please reload this page.
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)What kind of change does this PR introduce?
Bug fix
What is the current behavior?
github.com/arduino/arduino-cli/i18n.Tr
provides afmt.Printf
-style interface, where the first argument may serve as a template filled by subsequent arguments according to its format verbs.The call modified in this PR contains a subsequent argument, but no verb in the format string to use it. This generates some cryptic content in the error message.
For example:
(note the unexpected
%!(EXTRA *cores.ToolRelease=arduino:bossac@1.7.0-arduino3)
)What is the new behavior?
The cryptic content is not present in the error message:
For example:
The tool name is already provided in the correctly configured
Message
field of the error, so there is no need to include it in theCause
field as well, so the spurious argument can be removed entirely rather than the alternative fix of adjusting the format string argument. I suspect the spurious argument was simply the result of a copy/paste error.Does this PR introduce a breaking change?
No breaking change