Skip to content

refactor: enable var-naming revive linter (#4493)#4910

Open
sulphur-swarm wants to merge 1 commit into
containerd:mainfrom
sulphur-swarm:fix/issue-4493-enable-var-naming-lint-check
Open

refactor: enable var-naming revive linter (#4493)#4910
sulphur-swarm wants to merge 1 commit into
containerd:mainfrom
sulphur-swarm:fix/issue-4493-enable-var-naming-lint-check

Conversation

@sulphur-swarm
Copy link
Copy Markdown

Summary

This PR re-enables the var-naming revive linter that was temporarily
disabled in #4490 when upgrading golangci-lint to v2.4.0.

Relates to #4493.

Note: The enforce-switch-style and redundant-test-main-exit linters
are handled separately in #4496.

Changes

  • Renamed User.UidUser.UID and ContainerdIDMap.UidMapContainerdIDMap.UIDMap in pkg/cmd/container/idmap.go, following Go naming conventions for acronyms (UID is an initialism in the standard Go initialisms list)
  • Updated all references to these fields in pkg/cmd/container/create_userns_opts_linux.go
  • Removed the now-unnecessary //nolint:revive comments from the struct definitions
  • Removed disabled: true from the var-naming revive rule in both .golangci.yml and mod/tigron/.golangci.yml

Testing

  • go vet ./pkg/cmd/container/... passes
  • revive with var-naming rule shows no violations

This fix was contributed with AI assistance by SwarmFix (sulphur-swarm).

Fix the single var-naming violation to re-enable the var-naming
revive lint check that was temporarily disabled in containerd#4490 when
upgrading golangci-lint to v2.4.0.

The violation was in pkg/cmd/container/idmap.go: struct fields
'Uid' and 'UidMap' were renamed to 'UID' and 'UIDMap' following
Go naming conventions for acronyms (UID is an initialism).

Relates to containerd#4493.
Complements containerd#4496 (which handles enforce-switch-style and
redundant-test-main-exit).

Signed-off-by: SwarmFix <swarmfix@sulphur-swarm.ai>
Comment thread mod/tigron/.golangci.yml
@@ -100,7 +100,6 @@ linters:
- name: enforce-switch-style
disabled: true
- name: var-naming
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.

This line can be now just removed?

type User struct {
Uid uint32
UID uint32
Gid uint32
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.

What about Gid?

Comment thread .golangci.yml
@@ -135,8 +135,6 @@ linters:
arguments: [205]
# 441 occurrences (at default 7). We should try to lower it (involves significant refactoring).
- name: var-naming
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.

This line can be just removed?

Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

UID and Gid have to be cased consistently

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.

2 participants