lxd: Remove lint exception for defer rule.#14649
Merged
tomponline merged 1 commit intocanonical:mainfrom Dec 13, 2024
Merged
Conversation
The defer rule was removed from our golangci-lint configuration in 0b3a094. With this change, the defer in this function (which is called in a for loop) no longer needs to be ignored by the linter. The defer rule was originally removed because refactoring existing code to stop calling defer within loops was resulting in subtle bugs that were hard to reason about. We have extensive tests for LXD, so we should: - Avoid calling defer inside a for loop, and watch for these in pull requests. - Focus on improving code quality from a TICS perspective first. Signed-off-by: Mark Laing <mark.laing@canonical.com>
tomponline
approved these changes
Dec 13, 2024
Member
There was a problem hiding this comment.
Are there any other ones like this we should remove?
Contributor
Author
I'll do a quick grep and have a look :) |
tomponline
added a commit
that referenced
this pull request
Dec 17, 2024
Some `//nolint` comments have become defunct after changes to the linter configuration. This PR removes them! Follow up to #14649
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.
The defer rule was removed from our golangci-lint configuration in 0b3a094. With this change, the defer in this function (which is called in a for loop) no longer needs to be ignored by the linter.
The defer rule was originally removed because refactoring existing code to stop calling defer within loops was resulting in subtle bugs that were hard to reason about.
We have extensive tests for LXD, so we should:
Closes #12854