nil maps in Golang
I’ve been a bit confused for a while over when a map in Golang gets created with a value of nil (its zero value) and when it does not, so I’m writing this to help me remember. Let’s look at various ways to initialize a map: package main import "fmt" func main() { m1 := map[string]string{} // initializes map m2 := make(map[string]string) // also initializes map var m3 map[string]string // does NOT initialize the map!...