🚀 Get 25% off access to all my premium courses - use discount code FUNCMAIN at checkout - view the pricing page now!

Sort Map by Value Image Sort Map by Value

In this code snippet, we are going to look at how you can quickly and easily sort maps in Go using the sort package.

When we run this, we should see that we are able to retrieve the values from our map in order of the length of the string key.

$ go run main.go
Elliot 25
Fraser 20
Sophie 24

Further Reading

If you enjoyed this code snippet, you may also enjoy these articles: