-
Notifications
You must be signed in to change notification settings - Fork 930
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
Refactor: Unexport all methods defined on private receivers in the lxc
package.
#13543
Merged
Conversation
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 was referenced Jun 4, 2024
tomponline
reviewed
Jun 4, 2024
tomponline
reviewed
Jun 4, 2024
tomponline
reviewed
Jun 4, 2024
The "checkPrivateReceivers" argument to the "exported" rule of the "revive" linter flags all of these methods. This rule was added to enforce comments e.g. exported methods for interface implementations where the implementing struct is kept private. The `Run` and `Command` methods are not called outside of the `lxc` package, so the rule is correctly indicating that these methods should not be exported. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
markylaing
force-pushed
the
unexport-cli-methods
branch
from
June 4, 2024 13:40
68bf15c
to
89876ed
Compare
Signed-off-by: Mark Laing <mark.laing@canonical.com>
The `io.ReadCloser` returned by the `fileGetWrapper` was captured by reference. As it was a named return value, this meant that the value of `buf` could change if the call to `GetInstanceFile` returned after the user signaled to cancel. This commit removes the named returns so that the value of `buf` cannot change after the function returns. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
markylaing
force-pushed
the
unexport-cli-methods
branch
from
June 4, 2024 13:46
89876ed
to
d516dca
Compare
tomponline
approved these changes
Jun 4, 2024
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!
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.
The current linting rules are flagging all
Run
andCommand
methods in thelxc
package as requiring a comment. These methods are following a pattern that was established years ago. None of the methods are imported elsewhere in the codebase and should be exported (the receivers are private and do not implement any interfaces). This PR unexports all methods defined on private receivers in thelxc
package, then fixes any remaining linter errors that surfaced as a result.See #13504 (comment) and #13540 (comment)