Skip to content
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: removes use of slices.DeleteFunc because it zeros the elements a… #29

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

faiq
Copy link

@faiq faiq commented Nov 4, 2024

…nd doesn't remove those from obj list

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@faiq faiq changed the title fix: removes use of slices.DeleteFunc because it zeros the elements a… 🐛fix: removes use of slices.DeleteFunc because it zeros the elements a… Nov 4, 2024
Comment on lines +348 to +354
newObjs := []unstructured.Unstructured{}
for _, o := range objs {
if !(o.GetKind() == "Endpoints" || o.GetKind() == "EndpointSlice") {
newObjs = append(newObjs, o)
}
}
objs = newObjs
Copy link
Collaborator

@dkoshkin dkoshkin Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this easier to read?

Suggested change
newObjs := []unstructured.Unstructured{}
for _, o := range objs {
if !(o.GetKind() == "Endpoints" || o.GetKind() == "EndpointSlice") {
newObjs = append(newObjs, o)
}
}
objs = newObjs
// skip resources generated by the Kubernetes API
// this is relevant if the versions are the same, because we compare
// the number of objects when version of objects are equal
newObjs := []unstructured.Unstructured{}
for _, o := range objs {
if o.GetKind() == "Endpoints" || o.GetKind() == "EndpointSlice" {
contiune
}
newObjs = append(newObjs, o)
}
objs = newObjs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm i guess the boolean logic there is a little confusing but it reads in less lines?

@faiq faiq merged commit 525eae9 into d2iq/release-1.8.4 Nov 4, 2024
8 of 9 checks passed
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.

3 participants