title: "missing type in composite literal" in golang
body: <p>Given these structs:</p>
  
  <pre><code>type InitRequest struct {
      ListenAddr      string
      ForceNewCluster bool
      Spec            Spec
  }
  
  type Spec struct {
      Annotations
  
      AcceptancePolicy AcceptancePolicy    `json:",omitempty"`
      //...
  }
  
  type AcceptancePolicy struct {
      Policies []Policy `json:",omitempty"`
  }
  
  type Policy struct {
      Role       NodeRole
      Autoaccept bool
      Secret     *string `json:",omitempty"`
  }
  </code></pre>
  
  <p>This code doesn't compile, exiting on that line with <em>missing type in composite literal</em>. Followed <a href="https://stackoverflow.com/questions/19482612/go-golang-array-type-inside-struct-missing-type-composite-literal">Go, Golang : array type inside struct, missing type composite literal</a> , but same error with:</p>
  
  <pre><code>swarm, err := cli.SwarmInit(context.Background(), swarm.InitRequest{
      ListenAddr:      "0.0.0.0:2377",
      ForceNewCluster: true,
      Spec: {
          AcceptancePolicy: {
              Policies: []Policy{
                  Policy: {
                      Role:       "manager",
                      Autoaccept: true,
                  },
              },
          }, // here
      },
  })
  </code></pre>
  
  <p>Any hint will be very helpful, thanks!</p>