Skip to content

updates and fixes to linters#4828

Merged
tonistiigi merged 3 commits into
moby:masterfrom
tonistiigi:linter-updates
Apr 9, 2024
Merged

updates and fixes to linters#4828
tonistiigi merged 3 commits into
moby:masterfrom
tonistiigi:linter-updates

Conversation

@tonistiigi
Copy link
Copy Markdown
Member

Enable new nilness and unusedwrite linters that seem to be quite useful and did point to some actual issues.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Comment thread .golangci.yml Outdated
- unusedwrite
# enable-all: true
# disable:
# - fieldalignment
Copy link
Copy Markdown
Member Author

@tonistiigi tonistiigi Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fieldalignment is also somewhat interesting. Enabling it would mean 100+ updates to current structs. How many of these cases actually have practical benefits is not fully clear to me yet. This could be considered but needs more analysis before.

Shadow could catch some issues, but currently there are quite a lot of places where we intentionally use the same variable name, and changing it could hurt readability.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With fieldalignment, wouldn't that mean we couldn't keep our structs ordered for readability? Unless the memory usage is incredibly dramatic, I'd prefer to allow ordering/grouping of struct fields to be done to keep readability of the code.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Copy link
Copy Markdown
Collaborator

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. +1 code format standardization 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants