Skip to content

Instantly share code, notes, and snippets.

@mattmc3
Last active April 5, 2017 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmc3/696d3c18d260697271734012695103a8 to your computer and use it in GitHub Desktop.
Save mattmc3/696d3c18d260697271734012695103a8 to your computer and use it in GitHub Desktop.
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