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
Top Programming Languages Behind Blockchain App Development
How to set timeout for http.Get() requests in Golang?
Go program to find MX records record of a domain
Interface embedding another interface in Go Programming Language
Example of Sscan vs Sscanf vs Sscanln from FMT Package
Undefined reference to <variable/function> error in Golang