good-practice
Golang SnippetsYou can use the make() function to create a new slice in Golang. // Output: test
Discussion at: https://devhubby.com/thread/how-to-make-a-slice-in-golang
Shortcut: create
import "fmt"
package main
func main() {
slice := []string{"test", "test2"}
// Output: test
fmt.Println(slice[0])
// or you can use make()
slice2 := make([]int, 2)
// Output: [0 0]
fmt.Println(slice2)
}