To initialize an anonymous struct, you have to declare the type. You declared the root anonymous struct, but you need to do again for each nested anonymous struct:
func wrapHal(selfHref string) interface{} {
return struct {
_links struct {
self struct {
href string
}
}
}{
_links: struct {
self struct {
href string
}
}{
self: struct {
href string
}{
href: "",
},
},
}
}
solved missing type in composite literal in nested struct [duplicate]