Skip to content

Conversation

tklauser
Copy link
Member

Make use of some newly added functionality added in Go 1.23.

See commit messages for details.

@tklauser tklauser added the release-note/misc This PR makes changes that have no direct user impact. label Sep 10, 2024
@tklauser tklauser requested review from a team as code owners September 10, 2024 08:59
Copy link
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

Looks good for my CODEOWNERs, thanks!

Copy link
Member

@dylandreimerink dylandreimerink left a comment

Choose a reason for hiding this comment

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

Files owned by teams I am on seem good!

Copy link
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

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

Looks good for envoy related files. Thanks.

Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

/lgtm for my codeowners

@tklauser tklauser force-pushed the pr/tklauser/stdlib-slices branch from a9eaab3 to 807bfc4 Compare September 10, 2024 13:22
@tklauser
Copy link
Member Author

tklauser commented Sep 10, 2024

/test

Rebased to resolve merge conflict.

Copy link
Contributor

@harsimran-pabla harsimran-pabla left a comment

Choose a reason for hiding this comment

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

BGP changes looks good. Thank you 🙏

The former is available since Go 1.21 and the latter is merely a wrapper
around it when using Go ≥ 1.21. Use the standard library package
directly.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Doing this because the slices functions are slightly faster and
easier to use. It also removes one dependency layer. This requires
changing SortedUniqueFunc to take the less function as a func(a, b T)
instead of func(i, j int) which is more idiomatic anyway.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
This allows GC to reclaim memory for these elements.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser force-pushed the pr/tklauser/stdlib-slices branch from 807bfc4 to 9a0cfa4 Compare September 10, 2024 21:27
@tklauser
Copy link
Member Author

tklauser commented Sep 10, 2024

/test

Rebased to resolve conflicts, once again.

In recent Go versions sort.{Ints,Strings} is already implemented in
terms of slices.Sort. This change removes that indirection and a
dependency layer.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Use the generic Contains* functions from the slices Go standard library
package instead of open-coding them across the code base. This also
allows simplifying some code.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser force-pushed the pr/tklauser/stdlib-slices branch from 9a0cfa4 to 13413c4 Compare September 10, 2024 22:10
@tklauser
Copy link
Member Author

/test

Copy link
Member

@rolinh rolinh left a comment

Choose a reason for hiding this comment

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

Very nice cleanup, lgtm for Hubble!

@tklauser tklauser added this pull request to the merge queue Sep 11, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Sep 11, 2024
Merged via the queue into main with commit 5dc208e Sep 11, 2024
257 checks passed
@tklauser tklauser deleted the pr/tklauser/stdlib-slices branch September 11, 2024 15:02
@dswaffordcw
Copy link
Contributor

❤️ the simplification! Thanks @tklauser!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cilium-cli This PR contains changes related with cilium-cli hubble-cli PRs or GitHub issues related with hubble-cli ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
None yet
Development

Successfully merging this pull request may close these issues.