func SortMapByValue(m map[string]int) []impounds {
var l []impounds
for k,v := range m{
l=append(l, impounds{k,v})
}
sort.Slice(l, func(i, j int) bool {
return l[i].Val > l[j].Val // 降序
})
return l
}
func SortMapByValue(m map[string]int) []impounds {
var l []impounds
for k,v := range m{
l=append(l, impounds{k,v})
}
sort.Slice(l, func(i, j int) bool {
return l[i].Val > l[j].Val // 降序
})
return l
}