Changelog Master Feed cover image

The bits of Go we avoid (and why) (Go Time #269)

Changelog Master Feed

00:00

How to Use slices.clip to Make Sure Nobody Overwrites the End of a Slice

There's a function in the experimental generic slices package, which has actually been approved to be added to go 121 next fall. It sets the capacity of the slice to whatever the current length of the slice is. And so that way, if anybody does append to it, they'll get a copy instead of rewriting the existing one. I feel like that's so much clearer. If you're reading some code and you see slices.clip, it's like, okay, that's what they're doing. They're just like making sure nobody overwrites the end of the slice. But yeah, it does look quite weird. Remove bear return. The issue number 2 1 2 9 1 proposal go

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app