TIL: Go reflect.DeepEqual to compare maps

2021-11-11 00:00:00 +0000 UTC

When trying to compare a map, slice, or struct in Go it may be necessary to use reflect.DeepEqual instead of the standard equality operator ==.

The rules for reflect.DeepEqual are defined in the above link. They don’t always work how you may expect – in those cases, it may be necessary to roll-your-own comparison function.

Tags: til golang