Concatenate slices

yourbasic.org/golang

Use the append functions with three dots after the second slice.

a := []int{1, 2}
b := []int{11, 22}
a = append(a, b...) // a == [1 2 11 22]

The ... unpacks b. Without the dots, the code would attempt to append the slice as a whole, which is invalid.

Further reading

Slices in a nutshell