I need to add slice type to this struct.
type Example struct {
text []string
}
func main() {
var arr = []Example {
{{"a", "b", "c"}},
}
fmt.Println(arr)
}
Then I am getting
prog.go:11: missing type in composite literal
[process exited with non-zero status]
So specify the composite literal
var arr = []Example {
{Example{"a", "b", "c"}},
But still getting this error:
cannot use "a" (type string) as type []string in field value
http://play.golang.org/p/XKv1uhgUId
How do I fix this? How do I construct the struct that contains array(slice) type?