(Wrong) Comparison is the Thief of Joy
summary
Shows concrete gotchas and fixes for Go comparisons: slices can’t be == so use arrays or reflect.DeepEqual or testify; JSON unmarshals numbers to float64 (so []int ≠ unmarshaled data) and only exported fields are marshaled unless embedded; protobuf autogenerated types mutate internal message state when printed so naive reflect compares fail — use Reset, compare exported fields, or use the cmp options to ignore unexported fields; maps differ between nil and empty so check len or construct matching empty maps.
AI-written summary · about
