I want to initialize a slice of structs (the structs are of type &dns.ResourceRecordSet
) where dns is the google cloud dns library. I am trying something like this
rr := []*gcp.ResourceRecordSet {
}{
&gcp.ResourceRecordSet{
Name: "example.gcp.com",
Ttl: 21600,
Type: "NS",
Rrdatas: []string{"ns-cloud-c1.googledomains.com.", "ns-cloud-c2.googledomains.com.", "ns-cloud-c3.googledomains.com.", "ns-cloud-c4.googledomains.com."},
},
&gcp.ResourceRecordSet{
Name: "example.gcp.com",
Ttl: 21600,
Type: "NS",
Rrdatas: []string{"ns-cloud-c1.googledomains.com.", "ns-cloud-c2.googledomains.com.", "ns-cloud-c3.googledomains.com.", "ns-cloud-c4.googledomains.com."},
},
}
But I get an error saying expected ';', found '{'
on the opening braces in the second line.
What is the correct syntax?