-
Notifications
You must be signed in to change notification settings - Fork 107
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
Fix linter errors raised by staticcheck #236
Fix linter errors raised by staticcheck #236
Conversation
Signed-off-by: Radoslav Dimitrov <[email protected]>
Pull Request Test Coverage Report for Build 2061288962Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
Thanks for working on fixing inter failures. I'd like a second set of eyes on the LocalStore
changes.
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.
ditto Joshua's comments
@trishankatdatadog @joshuagl - Thanks again! I've addressed the feedback 👍 |
I'll wait for Joshua's approval |
Signed-off-by: Radoslav Dimitrov <[email protected]>
cc74169
to
3704653
Compare
@trishankatdatadog @joshuagl - The tests caught some side effect of this that it deletes the "targets" folder in case there are no targets at all left in the repository. Do you think that can be a problem? If so, I can update the implementation to skip deleting folders named "targets". |
@trishankatdatadog @ethan-lowman-dd do you anticipate this behaviour causing problems, based on your experience deploying go-tuf? |
Is it really more dangerous to delete an empty folder than a target file? BTW, what folder is it: is it specific to that target, or is it for all targets? |
Previously, go-tuf ignored deleting folders without any targets in it. Meaning if we have a single target "foo/bar" and we delete it, the "foo" folder will remain even though there's nothing left to be served in it. Now, this change checks if the parent folder of the target we delete will be left empty, and if yes - deletes it too. In the example above where we delete a target "foo/bar" with location "./repository/targets/foo/bar" - deleting "bar" will delete the "foo" folder too (in case there are no more targets in it). So to your question - it is specific to that target. The side effect that was caught by the tests is about when we have only 1 target "bar" in the repository with location "./repository/targets/bar" - deleting it will also delete its parent directory, which in this case is the "./repository/targets" folder. We need to decide if this is the expected behavior and if not, what is the correct way to handle that? |
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.
This change seems reasonable, it's hard to imagine all scenarios where this might cause breakage. I'm inclined to merge and handle error reports if they are filed.
Signed-off-by: Radoslav Dimitrov <[email protected]>
Signed-off-by: Radoslav Dimitrov <[email protected]>
Approve again as you see fit? |
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.
Thanks all!
This is a small PR separating a few fixes for linter errors that would otherwise be raised by golangci-lint/staticcheck in #234.
Signed-off-by: Radoslav Dimitrov [email protected]