Map type
A map is an unordered group of elements of one type, called the element type, indexed by a set of unique keys of another type, called the key type. The value of an uninitialized map is nil.
Here is a simple go lang example that shows how to use of a map.
Source: (example.go)
package main
import "fmt"
func main() {
colors := make(map[int]string)
colors[1] = "Red"
colors[2] = "Orange"
colors[3] = "Yellow"
fmt.Println(colors)
fmt.Println(colors[1])
}
Output:
$ go run example.go
map[1:Red 2:Orange 3:Yellow]
Red