How to test the equivalence of maps in Golang?
The Go library has already got you covered. Do this: import “reflect” // m1 and m2 are the maps we want to compare eq := reflect.DeepEqual(m1, m2) if eq { fmt.Println(“They’re equal.”) } else { fmt.Println(“They’re unequal.”) } If you look at the source code for reflect.DeepEqual‘s Map case, you’ll see that it first checks … Read more