forked from runfinch/finch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error readable by using the right placeholder (#39)
*Description of changes:* Logs aren't as readable as they could be, I saw this during `finch vm init`: ``` INFO[0009] sudoers file not found: %!w(*fs.PathError=&{open /etc/sudoers.d/finch-lima 2}) ``` From the looks of it, we don't need the `%w` since the current logging implementation doesn't use `fmt.Errorf` under the hood anyway, and thus makes the output hard to read without the only potential benefit being utilised (unwrapping). And since the logging interface's methods themselves don't return anything, it's fairly likely unwrapping won't happen in any other implementation (there isn't even a reason for it anyway - the callee will have all the args available to it, so it can introspect the error passed directly). (Since this `Infof` call is made right after an `errors.Is`, the whole `%v`/`%w` bit is redundant as it will just say "sudoers file not found: no such file or directory", but I didn't want to change error semantics in this PR.) *Testing done:* `make test-unit` and using `logrus` directly to verify none of its `*f` methods use `fmt.Errorf`. - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Ondrej Kokes <ondrej.kokes@gmail.com> Co-authored-by: Weike Qu <47606630+weikequ@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters