我真是懒到一定程度了
```golang
func MergeMap(mObj ...map[string]string) map[string]string {
newObj := map[string]string{}
for _, m := range mObj {
for k, v := range m {
newObj[k] = v
}
}
return newObj
}
func main() {
extraAttributesMap := map[string]string{
TenantIDKey: "instance.TenantID",
UserIDKey: "instance.UserID",
HostIDKey: "instance.HostID",
StatusKey: "instance.Status",
ProgressKey: "123",
AccessIPv4Key: "instance.AccessIPv4",
FaultKey: "instance.Fault",
}
Metadata := map[string]string{
"1": "11",
"2": "22",
}
extraAttributes := MergeMap(extraAttributesMap, Metadata)
fmt.Println(extraAttributes)
}
```
#17
更多评论