FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor: enable var-naming revive linter (#4493) by sulphur-swarm · Pull Request #4910 · containerd/nerdctl · GitHub

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

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

Conversation

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.Uid → User.UID and ContainerdIDMap.UidMap → ContainerdIDMap.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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This line can be just removed?

AkihiroSuda left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL