Append is primarily used to append elements to a slice (slice)
If the tile storage space (CAP) is sufficient, it is added directly, the length (len) is longer, if there is not enough space, the memory is re-opened and the previous element is copied with the new element. The first parameter is a slice, followed by the variable parameter base usage of the slice storage element type:
Slice: = Append ([]int{1,2,3},4,5,6) fmt. Println (Slice)//[1 2 3 4 5 6] The second parameter can also be directly written to another slice, appending all of its element copies to the first slice. It is important to note that the parameters of this usage function can only receive two slice and add three points to the end
Slice: = Append ([]int{1,2,3},[]int{4,5,6} ...) fmt. Println (Slice)//[1 2 3 4 5 6] There is also a special use of the string as a []byte type as the second parameter passed in
Bytes: = Append ([]byte ("Hello"), "World" ...) the return value of the APPEND function must have a variable to receive, or the compiler will error, for specific reasons please refer to: http://blog.csdn.net/qq245671051/ article/details/50722823