Fix linter errors raised by staticcheck#236
Fix linter errors raised by staticcheck#236joshuagl merged 4 commits intotheupdateframework:masterfrom
Conversation
Signed-off-by: Radoslav Dimitrov <dimitrovr@vmware.com>
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 |
joshuagl
left a comment
There was a problem hiding this comment.
Thanks for working on fixing inter failures. I'd like a second set of eyes on the LocalStore changes.
trishankatdatadog
left a comment
There was a problem hiding this comment.
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 <dimitrovr@vmware.com>
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? |
joshuagl
left a comment
There was a problem hiding this comment.
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 <dimitrovr@vmware.com>
Signed-off-by: Radoslav Dimitrov <dimitrovr@vmware.com>
Approve again as you see fit? |
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 dimitrovr@vmware.com