From 3e6e67c4dcea3ac2f25fd4731abc0e1deaf36216 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Tue, 31 Mar 2015 13:55:04 -0700 Subject: Enable methods to sort map keys and spew itself as last resort If enabled by flags, try to use methods to stringify map keys and sort on that. If we can't use primitive sorting and we can't use methods, we can still fall back on spew itself. If SpewKeys is enabled, use Sprintf("%#v") to generate a string and sort by that. --- spew/dump.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spew/dump.go') diff --git a/spew/dump.go b/spew/dump.go index 983d23f..5783145 100644 --- a/spew/dump.go +++ b/spew/dump.go @@ -382,7 +382,7 @@ func (d *dumpState) dump(v reflect.Value) { numEntries := v.Len() keys := v.MapKeys() if d.cs.SortKeys { - sortValues(keys) + sortValues(keys, d.cs) } for i, key := range keys { d.dump(d.unpackValue(key)) -- cgit v1.2.3