若map的val唯一,且k,v类型相同,可以进行简单对调
m := map[string]int{"A": 1, "B": 2} m1 = make([]map[string]int, len(m)) for k, v := range m { m1[v] = k }