Suppose I have a map[string]int
, and I want the key with the shortest length (in bytes). If I don't know any particular element that the map contains, how do I get a sample of it so I can do
var shortest string
for key, _ := range myMap {
if len(key) < len(shortest) {
shortest = key
}
}