You can use maps.Values
from the golang.org/x/exp
package.
Values returns the values of the map m. The values will be in an indeterminate order.
If you want to change selection, open document below and click on "Move attachment"
dictionary - In Go how to get a slice of values from a map? - Stack Overflowcom/a/13427931/3172371 "hits" the target. – Mihail Jul 25, 2022 at 18:15 Add a comment | This answer is useful 61 This answer is not useful Save this answer. Show activity on this post. Go 1.18 <span>You can use maps.Values from the golang.org/x/exp package. Values returns the values of the map m. The values will be in an indeterminate order. func main() { m := map[int]string{1: "a", 2: "b", 3: "c", 4: "d"} v := maps.Values(m) fmt.Println(v) } The package exp includes experimental code. The signatures may or may not change i Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details