Can anyone recommend a good package or method of comparing two values of the same struct type?
For example, I have struct 1 and struct 2, both of the same type. I want to compare them to see if the values in the fields in both structs are the same (maybe even just specific fields in each struct). If they’re the same, great, but if not, what fields have different values and how can I then make them the same?
This only works if none of the struct’s fields (or fields of any structs embedded within the struct you’re comparing) are maps, slices, or chans. If they are, then try reflect.DeepEqual instead of just ==: https://play.golang.org/p/mLGKzr9sMlb