Member-only story
Go Arrays vs Slices: A Deep Comparison That Will Change How You Write Go
The most misunderstood duality in Go — and the subtle bugs it quietly ships to production
Here is a scenario you may recognise: a function modifies a slice, you print it in the caller — and nothing changed. Or the opposite: two independent slices start changing each other’s data for no obvious reason. You stare at it, add a fmt.Println, and the behaviour shifts. Welcome to the backing-array rabbit hole.
You reach for []int almost reflexively. Slices everywhere. That is fine — slices are idiomatic Go. But when you do not understand why a slice behaves the way it does at the memory level, you will ship a bug that takes an afternoon to debug. Mutations that vanish after a function call. Sub-slices that silently corrupt each other. Append calls that look like they work — until load test day.
This article is not a basics recap. It is a detailed, production-level comparison of arrays and slices in Go 1.26 — covering memory layout, function semantics, the append trap, and when to actually reach for each one.







