Wayan Jimmy's Brain

Map is reference type

Learn go with tests

An interesting property of maps is that you can modify them without passing them as a pointer. This is because map is a reference type.

Meaning it holds a reference to the underlying data structure, much like a pointer.

Always initialize an empty map

Therefore, you should never initialize an empty map variable

var m map[string]string

Instead, you can initialize an empty map like we were doing above, or use the make keyword to create a map for you

var dictionary = map[string]string{}

// OR

var dictionary = make(map[string]string)