From d66e3d5866ad3224f40bd963b96d204bb470235f Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Thu, 16 Nov 2017 19:08:48 +0000 Subject: [PATCH] When resetting a doc, reset it to an empty map --- util/data/data.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/data/data.go b/util/data/data.go index 57b5d7ce..2dabba4f 100644 --- a/util/data/data.go +++ b/util/data/data.go @@ -281,7 +281,7 @@ func (d *Doc) what(p string, a []interface{}, t int8) (o []interface{}, i []int, // Reset empties and resets the data at the specified path. func (d *Doc) Reset(path ...string) (*Doc, error) { - return d.Set(nil, path...) + return d.Set(map[string]interface{}{}, path...) } // Valid checks whether the value at the specified path is nil. @@ -707,7 +707,7 @@ func (d *Doc) ArrayAdd(value interface{}, path ...string) (*Doc, error) { } else { for _, v := range a { if reflect.DeepEqual(v, value) { - return nil, nil + return Consume(a), nil } } a = append(a, value)