summaryrefslogtreecommitdiff
path: root/spew/dump.go
diff options
context:
space:
mode:
authordeads2k <[email protected]>2015-01-19 10:22:19 -0500
committerdeads2k <[email protected]>2015-01-19 11:34:19 -0500
commit1aaf839fb07e099361e445273993ccd9adc21b07 (patch)
treef697f218f243b0602313b5230dd50b1bc8918ad7 /spew/dump.go
parent83f84dc933714d51504ceed59f43ead21d096fe7 (diff)
make nil maps appear different than empty maps
Diffstat (limited to 'spew/dump.go')
-rw-r--r--spew/dump.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/spew/dump.go b/spew/dump.go
index 02d4c9d..983d23f 100644
--- a/spew/dump.go
+++ b/spew/dump.go
@@ -367,6 +367,12 @@ func (d *dumpState) dump(v reflect.Value) {
// been handled above.
case reflect.Map:
+ // nil maps should be indicated as different than empty maps
+ if v.IsNil() {
+ d.w.Write(nilAngleBytes)
+ break
+ }
+
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {