Skip to content

Simplify some code with slices and for-range.#1237

Open
atombrella wants to merge 2 commits intocontainernetworking:mainfrom
atombrella:feature/modernize_update
Open

Simplify some code with slices and for-range.#1237
atombrella wants to merge 2 commits intocontainernetworking:mainfrom
atombrella:feature/modernize_update

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...

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