I have a table-driven test case like this one:
func CountWords(s string) map[string]int
func TestCountWords(t *testing.T) {
var tests = []struct {
input s
Disclaimer: Unrelated to map[string]int but related to testing the equivalence of maps in Go, which is the title of the question
If you have a map of a pointer type (like map[*string]int), then you do not want to use reflect.DeepEqual because it will return false.
Finally, if the key is a type that contains an unexported pointer, like time.Time, then reflect.DeepEqual on such a map can also return false.