To create a map with a key of type struct in Go, you first need to define your struct. For example:
main.go65 chars5 lines
Then, you can create a map with keys of type Person:
main.go31 chars2 lines
You can then add items to the map as follows:
main.go151 chars6 lines
You can access values in the map using a key of type Person as follows:
main.go43 chars2 lines
And you can iterate over the map using a for ... range
loop:
main.go145 chars7 lines
gistlibby LogSnag