~/talk

Wrong Comparison is the Thief of Joy

Talkat GopherConAU 2024 · 2024-11-06..11-08· [testing, developer-experience]
name:Elisa Xu
links:none on file
slides:none on file

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

  1. 0:00Introduction to comparison
  2. 1:48Comparing slices in Go
  3. 6:47Slices of any and marshaling
  4. 12:04Custom types and unexported fields
  5. 16:41Protobuf and state changes
  6. 23:44Maps and nil vs empty
  7. 27:58Closing thoughts and summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.