Arrays, slices (and strings): The mechanics of 'append' - The Go Programming Language
6
Public whispers
6
Contributors
2026-07-26 10:01:15
First whispered
Public whispers on this page
Text Highlight2026-07-26 16:25:15
Original Highlight Excerpt
"Even though the slice header is passed by value"
Whisper Note
This is exactly why slices feel like references even though they're not.
Text Highlight2026-07-26 13:22:15
Original Highlight Excerpt
"s important to understand that even though a slice contains a pointer"
Whisper Note
So it's like a struct with a pointer inside? That actually clears things up.
Text Highlight2026-07-26 13:13:15
Original Highlight Excerpt
"s important to understand that even though a slice contains a pointer"
Whisper Note
Yeah, took me a while to get that slices are values, not just pointers.
Text Highlight2026-07-26 10:19:15
Original Highlight Excerpt
"A slice is not an array."
Whisper Note
Yeah, but honestly the distinction only bites you when you mess with append too much.
Text Highlight2026-07-26 10:10:15
Original Highlight Excerpt
"A slice is not an array."
Whisper Note
Always forget this—then I wonder why changing a slice changes the original array.
Text Highlight2026-07-26 10:01:15
Original Highlight Excerpt
"A slice is not an array."
Whisper Note
Wait, so a slice is like a view into an array, not the array itself? Mind blown.
Share this page's whispers
Short link
https://domwhisper.com/s/5dc012b6bd55Embed snippet
<iframe src="https://domwhisper.com/embed/5dc012b6bd55" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>See what people are discussing on go.dev
Install DomWhisper to view live whispers as you browse, and join the discussion.
Get the extension