package metadata func SetMetadata(metadataChild map[string]interface{}, oldMetadata map[string]interface{}) (map[string]interface{}, error) { if oldMetadata != nil { for k, v := range metadataChild { switch val := v.(type) { case map[string]interface{}: oldResourceMetadataData := oldMetadata[k].(map[string]interface{}) for key, val1 := range val { oldResourceMetadataData[key] = val1 } oldMetadata[k] = oldResourceMetadataData default: oldMetadata[k] = val } } return oldMetadata, nil } else { var oldMetadata = make(map[string]interface{}, len(metadataChild)) for k, v := range metadataChild { switch val := v.(type) { case map[string]interface{}: var resourceMetadataData = make(map[string]interface{}, len(val)) for key, val1 := range val { resourceMetadataData[key] = val1 } oldMetadata[k] = resourceMetadataData default: oldMetadata[k] = val } } return oldMetadata, nil } }