I am trying to use composite literal with maps but unable to use it as it shows some error.
please find the code below.
I am a newbie to Golang and perhaps have some less understanding about composite literals.
type Assessment struct{
StructuringForce map[string][]StructuringForce
}
type StructuringForce struct {
Principles map[string][]Capabilities
}
type Capability struct {
}
c1 := Capability{}
a1 := Assessment{
StructuringForce : map[string][]StructuringForce{
"Information Systems" , []StructuringForce{
StructuringForce{
Principles : map[string][]Capabilities{
"Integration of IT Services" ,[]Capabilities{
c1,
},
},
},
},
},
}
while constructing "a1" with composite literals I get "Missing key in map literals error".
But i can see that i have added keys.