+ 2
How to declare an array in a struct in golang
I want a array in the struct ,how to do it? Okay,i tried .. type Model struct{ list []string } Is it correct way of declaring?
1 Resposta
+ 1
Lucifer
Correct.
But if you want to create a object of this struct use this below declaration↓
func main(){
obj:=Modal{[]string{"item1", "item2"}}
}