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

chore: slices cleanup #361

Merged
merged 7 commits into from
Jan 31, 2024
Merged

chore: slices cleanup #361

merged 7 commits into from
Jan 31, 2024

Conversation

superlinkx
Copy link
Contributor

@superlinkx superlinkx commented Jan 29, 2024

Description

Refocuses our internal slices module as an extension of the newly available Go 1.21+ stdlib slices package. This involved renaming our slices module to slicesext and removing functions that stdlib now provides. All features that our slicesext module provide that the stdlib doesn't were kept as is.

This also backports an upcoming stdlib slices function into our extension module: Append!

Motivation and Context

  • Our slices module became a bit unwieldy after the upgrade to Go 1.21, since it directly collides with the name of the stdlib package with a different set of features, but some overlap
  • Removing functions that we maintain in favor of stdlib variants seemed like good hygiene
  • We've been needing a proper slice append function for a good long time, and with it right around the corner, it seemed prudent to start moving towards its use. slicesext uses the current version of this function since it's a fairly stable piece of code and isn't expected to have any API changes between now and Go 1.22 full release. When we eventually upgrade to Go 1.22, we can delete our copy as well as the copied test from our extension, but for now it lets us start using Append with a clean refactor path.

How Has This Been Tested?

All tests continue to pass. New tests added for new function (stolen and slightly tweaked from Go source).

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Documentation updates are needed, and have been made accordingly.
  • I have added and/or updated tests to cover my changes.
  • All new and existing tests passed.
  • My changes include a database migration.

@superlinkx superlinkx self-assigned this Jan 29, 2024
@superlinkx superlinkx marked this pull request as ready for review January 31, 2024 22:03
Copy link
Collaborator

@zinic zinic left a comment

Choose a reason for hiding this comment

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

No comments. Merge when passing.

Copy link
Contributor

@sircodemane sircodemane left a comment

Choose a reason for hiding this comment

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

Lgtm

@superlinkx superlinkx merged commit 2658363 into main Jan 31, 2024
3 checks passed
@superlinkx superlinkx deleted the slices-cleanup branch January 31, 2024 22:52
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants