slice string golang code example Example 1: go slice initialization mySlice := []int{1, 2, 3, 4, 5} Example 2: go add to slice var s []int s = append(s, 0)