-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: fix slice init length #35164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix slice init length #35164
Conversation
Commit 3746263 does not match "(?m)^Signed-off-by:". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
@rusttech thanks for the PR! Can you elaborate a bit in the commit description what exact issue is this change fixing, how did you test that performance is better before and after the change (I assume there is a performance issue caused by unnecessary allocations made by Also please follow instructions from the comment above to sign off the commit. |
Thanks. I have add sign off info. As for the change, the current code, because the length of the initialization slice is len (podsList. Items), will ultimately result in the first len (podsList. Items) elements of pods not being the target value, but podsList The null value corresponding to Items The online demo: https://go.dev/play/p/q1BcVCmvidW |
/test |
(I just realized that this PR might end up failing CI due to the breakage in |
Signed-off-by: rusttech <gopher@before.tech>
/test |
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXX
line if the commit addresses a particularGitHub issue.
Fixes: <commit-id>
tag, thenplease add the commit author[s] as reviewer[s] to this issue.
The intention here should be to initialize a slice with a capacity of len(podsList.Items) rather than initializing the length of this slice.