Fix clilog file names for link errors#31
Merged
bwplotka merged 2 commits intobwplotka:mainfrom May 19, 2021
Merged
Conversation
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
bwplotka
approved these changes
May 19, 2021
Owner
bwplotka
left a comment
There was a problem hiding this comment.
Nice! Some implementation nits only
|
|
||
| merr := merrors.New() | ||
| base, err := os.Getwd() | ||
| if err != nil { |
Owner
There was a problem hiding this comment.
Couple of things:
merr.Addalready checks iferr != nilso no need to check again- Don't wrap with
Wrapfif there is no argument, use justWrap - No need to say something failed - you are wrapping failure after all, so just
resolve working dirwould be ok - Are we sure we want to continue after those errors and not fail whole thing? why?
Collaborator
Author
There was a problem hiding this comment.
Oh yes! Would be better to fail whole thing and return error rather than add to merr. Will implement this! Would need to keep err != nil checks in this case.
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28.
Currently, link checking errors are handled by merrors and are pretty printed when
log.formatis set toclilog(this is set to default since it is human-readable). However the filenames of the relevant errors are not shown inclilogeven though it is wrapped. This is due to thePrettyPrintfunction which in turn callserrors.As(). According to docs the passed in error is repeatedly unwrapped which causes us to lose the filename. There is also no way to pass in the filename without losing the pretty print functionality,This PR fixes this by wrapping each error with the relative path of the file it originates from thus allowing us to have logs like below,