Create a map with make or a literal:
// Using make
ages := make(map[string]int)
// Using a literal
ages := map[string]int{
"Alice": 30,
"Bob": 25,
}
The make function creates an empty map ready for use. A literal lets you provide initial values. Both create a usable map. Choose based on whether you have initial data.