ended3월 21일· 1 sources

Go Slices: Why Your Function Isn't Changing What You Think It Is

Go 슬라이스: 함수에서 값이 바뀌지 않는 진짜 이유

Why it matters

This beginner-friendly article explains why modifying a slice inside a Go function sometimes reflects in the caller and sometimes doesn't. It uses a 'sticky note' mental model to show that a slice header (pointer, length, capacity) is copied by value, so element mutations are visible but append changes are not unless a pointer is passed. It also covers deep cloning with copy() for full isolation.

1
Sources
+0
24h
Growth
180d
Active
Go SlicesPass by ValuePass by ReferenceBacking ArrayDeep Clone

Sources

Related Issues