I need to add slice type to this struct.
type Example struct {
text []string
}
func main() {
var arr = []Example {
{{\"a\", \"b\", \"c\"}},
Here is your proper slice of Example
struct:
[]Example{
Example{
[]string{"a", "b", "c"},
},
}
Let me explain it. You want to make a slice of Example
. So here it is — []Example{}
. Then it must be populated with an Example
— Example{}
. Example
in turn consists of []string
— []string{"a", "b", "c"}
. It just the matter of proper syntax.
Hope that helps.