golang filling a string array model

Viewed 187

I cant figure out a way to fill the array string of the below simple model. What I have tried is also give. How do I fill the array string "Alternate"?

func main() {
    type Person struct {
        FirstName string   `json:"FirstName,omitempty"`
        LastName  string   `json:"Lastname,omitempty"`
        Age       string   `json:"Age,omitempty"`
        Alternate []string `json:"Alternate,omitempty"`
    }

    p1 := Person{FirstName: "Rajeev", LastName: "Singh", Age: "27", Alternate: ["Samantha Holder"]}

    fmt.Println(p1)
}
1 Answers
Related