Skip to content

There are cases we cannot deepcopy #28

@HarutakaMatsumoto

Description

@HarutakaMatsumoto

Hello!

Somehow Copy function cannot deepcopy an array of list of list.
A example test is following.

package deepcopytest

import (
	"testing"

	"github.com/mohae/deepcopy"
)

type a [3][][]float64

var source = a{
	{
		{
			1.0,
			2.0,
			3.0,
		},
	},
}

func TestDeepcopy(t *testing.T) {
	distination := deepcopy.Copy(source).(a)
	source[0][0][0] = 4.0
	source[0][0][1] = 5.0
	source[0][0][2] = 6.0

	if distination[0][0][0] == source[0][0][0] {
		t.Fatal("Isn't deepcopied!", distination, source)
	}
}

Please make it can deepcopy.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions