初始化第三方库的一部分结构

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?

You have an extra }{ you shouldn't have, the code should look 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."},
    },
}

You're creating a slice literal with elements that are (addresses of) struct literals. A slice literal looks like:

rr := []TYPE{
  element,
  element,
}

You instead had

rr := []TYPE{
}{
  element,
  element,
}