Simplify some code with slices and for-range. by atombrella · Pull Request #1237 · containernetworking/plugins

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@atombrella

Copy link

Contributor

I applied a few of the modernize rules to simplify the code slightly:

  • slices.Contains removes some chunks of iterations that do exactly what can be leveraged to slices.Contains
  • for range N which is syntactic sugar.
  • A single // +build which definitely needs to go.
  • slices.Sort instead of sort.Slice.

The golangci-lint version is a bit old, and I didn't want to tamper around with it in this PR.

@atombrella atombrella force-pushed the feature/modernize_update branch from fa75f5b to afa7a75 Compare

March 8, 2026 21:10
Signed-off-by: Mads Jensen <atombrella@users.noreply.github.com>

@atombrella atombrella force-pushed the feature/modernize_update branch from afa7a75 to 2d7d599 Compare

March 8, 2026 21:35

@atombrella

Copy link

Contributor Author

@s1061123 Care to have a look? I could enable the modernize linter with some rules in golangci-lint.yaml

@s1061123

Copy link

Contributor

I don't have so much time these days, hence I recommend to find another guy to review...

@s1061123

Copy link

Contributor

In addition, this PR and your another one seems to be 'golang syntax improvement to modern', hence the priority looks lower than other serious one (such as bug fix and security one and so on).
Currently unfortunately we need a lot of such tasks, so please wait for a while.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@atombrella @s1061123