How append a slice to an existing slice in Golang?
The usage of triple-dot ... ellipsis used to append a slice.
Example
package main
import "fmt"
func main() {
var slice1 = []string{"india", "japan", "canada"}
var slice2 = []string{"australia", "russia"}
slice2 = append(slice2, slice1...)
}
Most Helpful This Week
How do you handle HTTP requests in Go?
GO Program to Swap Number Without Using Temporary Variables
Program in Go language to Find Largest Element of an Array
Create and Print Multi Dimensional Slice in Golang
Golang program for implementation of Rabin-Karp
Go program to find Forward(A) record of a domain