开始-初始化一个空切片

To declare an empty slice, I know that you should prefer

var t []string

over

t := []string{}

as it doesn't allocate unecessary memory (https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices). Does this still apply if I have

type example struct {
    s []string
}
e := &example{}

i.e. would it be better to use

e.s = []string{}

or

var s []string
e.s = s

example.s is already declared, so there's nothing you need to do.

e := &example{}
e.s = append(e.s, "val")
fmt.Println(e.s)