Simplify some code with slices and for-range. by atombrella · Pull Request #1237 · containernetworking/plugins
Navigation Menu
{{ message }}
containernetworking / plugins Public
- Notifications You must be signed in to change notification settings
- Fork 851
Open
atombrella wants to merge 2 commits intocontainernetworking:mainfrom
Open
Simplify some code with slices and for-range.#1237
atombrella wants to merge 2 commits intocontainernetworking:mainfrom
Simplify some code with slices and for-range.#1237
atombrella wants to merge 2 commits intocontainernetworking:mainfrom
Conversation
Copy link
Contributor
atombrella
commented
Mar 8, 2026
atombrella
commented
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
// +buildwhich definitely needs to go. slices.Sortinstead ofsort.Slice.
The golangci-lint version is a bit old, and I didn't want to tamper around with it in this PR.
atombrella
force-pushed
the
feature/modernize_update
branch
from
fa75f5b to
afa7a75
Compare
Signed-off-by: Mads Jensen <atombrella@users.noreply.github.com>
atombrella
force-pushed
the
feature/modernize_update
branch
from
afa7a75 to
2d7d599
Compare
Copy link
Contributor Author
atombrella
commented
Mar 20, 2026
atombrella commented
Mar 20, 2026@s1061123 Care to have a look? I could enable the modernize linter with some rules in golangci-lint.yaml
Copy link
Contributor
s1061123
commented
Mar 20, 2026
s1061123 commented
Mar 20, 2026I don't have so much time these days, hence I recommend to find another guy to review...
Copy link
Contributor
s1061123
commented
Mar 21, 2026
s1061123 commented
Mar 21, 2026In 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.
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