refactor: enable var-naming revive linter (#4493)#4910
Open
sulphur-swarm wants to merge 1 commit into
Open
Conversation
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>
AkihiroSuda
reviewed
May 20, 2026
| @@ -100,7 +100,6 @@ linters: | |||
| - name: enforce-switch-style | |||
| disabled: true | |||
| - name: var-naming | |||
Member
There was a problem hiding this comment.
This line can be now just removed?
AkihiroSuda
reviewed
May 20, 2026
| type User struct { | ||
| Uid uint32 | ||
| UID uint32 | ||
| Gid uint32 |
AkihiroSuda
reviewed
May 20, 2026
| @@ -135,8 +135,6 @@ linters: | |||
| arguments: [205] | |||
| # 441 occurrences (at default 7). We should try to lower it (involves significant refactoring). | |||
| - name: var-naming | |||
Member
There was a problem hiding this comment.
This line can be just removed?
AkihiroSuda
requested changes
May 20, 2026
Member
AkihiroSuda
left a comment
There was a problem hiding this comment.
UID and Gid have to be cased consistently
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.
Summary
This PR re-enables the
var-namingrevive linter that was temporarilydisabled in #4490 when upgrading golangci-lint to v2.4.0.
Relates to #4493.
Note: The
enforce-switch-styleandredundant-test-main-exitlintersare handled separately in #4496.
Changes
User.Uid→User.UIDandContainerdIDMap.UidMap→ContainerdIDMap.UIDMapinpkg/cmd/container/idmap.go, following Go naming conventions for acronyms (UID is an initialism in the standard Go initialisms list)pkg/cmd/container/create_userns_opts_linux.go//nolint:revivecomments from the struct definitionsdisabled: truefrom thevar-namingrevive rule in both.golangci.ymlandmod/tigron/.golangci.ymlTesting
go vet ./pkg/cmd/container/...passesrevivewithvar-namingrule shows no violationsThis fix was contributed with AI assistance by SwarmFix (sulphur-swarm).