How to initialise nested structs in go? [duplicate]
问题 This question already has answers here : Initialize a nested struct (8 answers) Closed 4 years ago . Hi I am very new to Golang, please help me. I have defined a struct inside a struct. But I get an error when I try to initialise the main struct. type DetailsFilter struct { Filter struct { Name string ID int } } var M map[string]interface{} M = make(map[string]interface{}) M["Filter"] = map[string]interface{}{"Name": "XYZ", "ID": 5} var detailsFilter = DetailsFilter{Filter: M["Filter"]}} The