Learn how to Create an Empty Slice in Golang
If you need to create an empty slice in Go, then you are able to do the next:
Possibility 1 – Initialize an Empty Slice in Go#
package deal important
import "fmt"
func important() {
b := []string{}
fmt.Println(b == nil)
}
Possibility 2 – Utilizing make()
#
package deal important
import "fmt"
func important() {
c := make([]string, 0)
fmt.Println(c == nil)
}