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

Use go1.21 slices package in map #532

Open
wants to merge 2 commits into
base: fxamacker/use-slice-pkg-funcs-in-array
Choose a base branch
from

Conversation

fxamacker
Copy link
Member

@fxamacker fxamacker commented Feb 28, 2025

Updates #464

Go 1.21 introduced the slices package, so we can replace some code by using it to improve readability and maintenance.

This commit simplifies insertion, removal, and clone for slices in map non-test code by using:

  • slices.Insert()
  • slices.Delete()
  • slices.Clone()

NOTE: This PR changes non-test code, so I briefly ran smoke tests locally on this code and no problems were detected. Longer smoke tests will be run before next release tag.


  • Targeted PR against main branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Go 1.21 introduced the slices package, so we can replace some
code by using it to improve readability and maintenance.

This commit simplifies insertion, removal, and clone for slices
in map non-test code by using these slices pkg functions:
- slices.Insert()
- slices.Delete()
- slices.Clone()
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great to see how the high-level functions reduce a lot of brittle boiler-plate 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants