Skip to content(if available)orjump to list(if available)

Go Data Structures

Go Data Structures

12 comments

·February 5, 2025

eu

it’s a good read, but i think it should focus more on some of the common mistakes that people make when slicing a slice.

rednafi

Slicing a slice is full of gotchas. I tend to forget all the rules and avoid it whenever I can.

rendaw

Appending a slice is also full of gotchas. Sometimes it modifies the slice in place, sometimes it reallocates and copies.

bborud

It is a suprisingly hard thing to implement well. I have no idea how many times I have implemented slice-like things in C (back in the 1990-2000s when I mostly wrote C) and it was one of those things I never managed to be happy with.

neonsunset

It can be done but that requires a better, more expressive type system.

WolfCop

(2009)

rednafi

It's Go we're talking about. Other than 64-bit the dominant word size, nothing much has changed.

4ad

The interface layout has changed since the article (although this specific article doesn't mention interfaces, a later article in the series does). Additionally Go now has generics.

It's true that little has changed, but very little is changing in the data representation of any language, really. Even ones that are evolving rapidly.