From 1aaf839fb07e099361e445273993ccd9adc21b07 Mon Sep 17 00:00:00 2001 From: deads2k Date: Mon, 19 Jan 2015 10:22:19 -0500 Subject: make nil maps appear different than empty maps --- spew/format.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spew/format.go') diff --git a/spew/format.go b/spew/format.go index b6b1fb0..cc152ae 100644 --- a/spew/format.go +++ b/spew/format.go @@ -296,6 +296,12 @@ func (f *formatState) format(v reflect.Value) { // been handled above. case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + f.fs.Write(openMapBytes) f.depth++ if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { -- cgit v1.2.3