Skip to content

Commit

Permalink
Correct valuesSorter.Less function for uintptr.
Browse files Browse the repository at this point in the history
The function sort be sorting the uintptr itself, not the address of it.
Also, the previous code could easily panic on an unaddressable
reflect.Value since it was trying to take an address.
  • Loading branch information
davecgh committed Nov 15, 2013
1 parent 67c401c commit 3b4a205
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spew/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (s *valuesSorter) Less(i, j int) bool {
case reflect.String:
return s.values[i].String() < s.values[j].String()
case reflect.Uintptr:
return s.values[i].UnsafeAddr() < s.values[j].UnsafeAddr()
return s.values[i].Uint() < s.values[j].Uint()
}
return s.values[i].String() < s.values[j].String()
}
Expand Down

0 comments on commit 3b4a205

Please sign in to comment.