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

Remove stdlib api functions now that we're on Go 1.23 #3639

Merged
merged 2 commits into from
Feb 24, 2025

Conversation

pkwarren
Copy link
Member

No description provided.

Copy link
Contributor

github-actions bot commented Feb 18, 2025

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 21, 2025, 4:08 PM

@@ -50,8 +51,11 @@ func newFiles[F InputFile](
}
return files, nil
}

chunks := slicesext.ToChunks(indexedInputFiles, chunkSize)
// slices.Chunk panics if given a chunk size less than 1 - allocate a single chunk in this case.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is one difference between the previous slicesext.ToChunks implementation and the stdlib one, although it doesn't seem too bad in practice. If desired, I could re-add the method to slicesext and add this handling there but still re-use the stdlib method.

Copy link
Member

Choose a reason for hiding this comment

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

Let's re-add the method to slicesext with the handling encapsulated since the slicesext package is staying, so I think it makes sense to minimize the impact of this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added back in b52fd39 and re-added tests.

@@ -12,36 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Some implementations are copied from "slices", and hence
Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like any methods from stdlib slices have been removed now so removed this notice.

@pkwarren pkwarren requested a review from saquibmian February 18, 2025 20:38
Copy link
Contributor

@saquibmian saquibmian left a comment

Choose a reason for hiding this comment

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

LGTM but I'd probably wait for a CLI code owner.

Add back the slicesext.ToChunks which has additional mitigations to
prevent running into a panic in cases where the chunk size is 0.
@pkwarren pkwarren merged commit 72d85fb into main Feb 24, 2025
10 checks passed
@pkwarren pkwarren deleted the pkw/remove-stdlib-apis branch February 24, 2025 17:30
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