瀏覽代碼

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.
Dave Collins 12 年之前
父節點
當前提交
3b4a2055ce
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      spew/common.go

+ 1 - 1
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()
 }