summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2013-11-14 22:03:41 -0600
committerDave Collins <[email protected]>2013-11-14 22:03:41 -0600
commit3b4a2055ceb3d3f007cad35f3766431c93ef457d (patch)
treeef24be3b2db1d081a9f8cf0c1f0b2ef88984ae11
parent67c401cf121f235f32b5ecbfc7989b88709b57d9 (diff)
Correct valuesSorter.Less function for uintptr.
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.
-rw-r--r--spew/common.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/spew/common.go b/spew/common.go
index 6f67a0c..0e59eca 100644
--- a/spew/common.go
+++ b/spew/common.go
@@ -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()
}