I am having trouble calling the append
function in Go
type Dog struct {
color string
}
type Dogs []Dog
I want to append "Dog" into "Dogs".
I tried doing this
Dogs = append(Dogs, Dog)
But I get this error
First argument to append must be slice; have *Dogs
Sorry, I'm new to Go.
Thanks!
Edit: Also, if I want to check if this Dog contains the color "white", for example. How would I call this?
if Dog.color.contains("white") {
//then append this Dog into Dogs
}