Go: Get slices of keys and values from a map

keys := make([]keyType, 0, len(myMap))
values := make([]valueType, 0, len(myMap))

for k, v := range myMap {
        keys = append(keys, k)
        values = append(values, v)
}

Comments

Be the first to comment!