func main(){ var array [10]int sliceA := array[0:5] append(sliceA, 4) fmt.Println(sliceA) }
Error : append(sliceA, 4
Per the Go docs:
The resulting value of append is a slice containing all the elements of the original slice plus the provided values.
So the return value of 'append', will contain your original slice with the appended portion.