Append and capacity
append adds elements and may reallocate:
s := make([]int, 3, 5) // len 3, cap 5
s = append(s, 4) // len 4
s = append(s, 5) // len 5
s = append(s, 6) // grows cap to 10
When a slice exceeds its capacity, Go allocates a larger array and copies the data. Reusing the old slice variable avoids subtle bugs.