Skip to content

run go fix and add the modernize linter - #335

Open
tariq1890 wants to merge 1 commit into
containerd:mainfrom
tariq1890:go-modernize
Open

tariq1890 wants to merge 1 commit into
containerd:mainfrom
tariq1890:go-modernize

Conversation

@tariq1890

@tariq1890 tariq1890 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

This change introduces numerous improvements in go code which makes use of the latest features and improvements added to the more recent versions of go. It also adds the "modernize" linter to ensure future changes in the Go code base also incorporate the Go code modernizations.

To learn more, please refer to this page.

samuelkarp
samuelkarp previously approved these changes Oct 22, 2026
@samuelkarp
samuelkarp dismissed their stale review October 22, 2026 23:15

Modernize linter found more things to fix.

@tariq1890

Copy link
Copy Markdown
Contributor Author
  Error: pkg/runtime-tools/generate/helpers_linux.go:51:22: stringsseq: Ranging over SplitSeq is more efficient (modernize)
  	for _, opt := range strings.Split(mnt.Optional, " ") {
  	                    ^
  Error: pkg/runtime-tools/generate/helpers_linux.go:69:2: slicescontains: Loop can be simplified using slices.Contains (modernize)
  	for _, p := range accepted {
  	^
  2 issues:

Weird, my local golangci-lint run ./... did not catch those. I will fix them

@tariq1890

Copy link
Copy Markdown
Contributor Author

Oh of course, I am on a MBP :). I needed to set GOOS=linux

This change introduces numerous improvements in go code which makes use
of the latest features and improvements added to the more recent versions
of go. It also adds the "modernize" linter to ensure future changes in the
Go code base also incorporate the Go code modernizations.

Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
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