Wrong Comparison is the Thief of Joy
summary
Explains concrete gotchas when comparing Go values: slices can’t be == so use testify/assert or reflect.DeepEqual; JSON unmarshalling turns numbers into float64 so an []any becomes []float64; unexported struct fields drop during JSON marshal; protobuf’s generated structs change state when printed so run its Reset or compare exported fields directly or use a compare-opts package to ignore unexported fields; map nil vs empty map mismatches require careful construction and explicit nil checks.
AI-written summary · about
chapters (7)
- 0:00Introduction to comparison
- 1:48Comparing slices in Go
- 6:47Slices of any and marshaling
- 12:04Custom types and unexported fields
- 16:41Protobuf and state changes
- 23:44Maps and nil vs empty
- 27:58Closing thoughts and summary








