Last active
April 5, 2017 23:57
-
-
Save mattmc3/696d3c18d260697271734012695103a8 to your computer and use it in GitHub Desktop.
Golang sort map keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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