diff --git a/util/data/data.go b/util/data/data.go index 76c01414..57b5d7ce 100644 --- a/util/data/data.go +++ b/util/data/data.go @@ -57,8 +57,8 @@ func (d *Doc) Data() interface{} { } // Copy returns a duplicated copy of the internal data object. -func (d *Doc) Copy() (i interface{}) { - return deep.Copy(d.data) +func (d *Doc) Copy() *Doc { + return &Doc{data: deep.Copy(d.data)} } // Encode encodes the data object to a byte slice. diff --git a/util/data/data_test.go b/util/data/data_test.go index 280adea4..5fbae888 100644 --- a/util/data/data_test.go +++ b/util/data/data_test.go @@ -1048,7 +1048,7 @@ func TestOperations(t *testing.T) { // ---------------------------------------------------------------------------------------------------- Convey("Can copy object", t, func() { - So(doc.Copy(), ShouldResemble, doc.Data()) + So(doc.Copy().Data(), ShouldResemble, doc.Data()) }) // ----------------------------------------------------------------------------------------------------