Skip to content

Instantly share code, notes, and snippets.

@mattmc3 mattmc3/sort_map.go
Last active Apr 5, 2017

Embed
What would you like to do?
Golang sort map keys
keys := make([]string, len(m))
i := 0
for k := range m {
keys[i] = k
i++
}
sort.Strings(keys)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.