deepcopy

package
v3.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2025 License: MIT, MIT Imports: 2 Imported by: 1

README

Sometimes you may want to limit deep copying from copying some leaf type.

Currently you CAN do so, this way:

    Make your type implement the IDeepCopy interface, and do copying yourself, e.g. just copy
    the pointer.

If your type is impossible to extend with methods, e.g. that's a library type, then:

    Make a wrapper for your type.

    Make the wrapper implement the IDeepCopy interface.

===

Documentation

Overview

deepcopy makes deep copies of things. A standard copy will copy the pointers: deep copy copies the values pointed to. Unexported field values are not copied.

Copyright (c)2014-2016, Joel Scoble (github.com/mohae), all rights reserved. License: MIT, for more details check the included LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src interface{}) interface{}

Copy creates a deep copy of whatever is passed to it and returns the copy in an interface{}. The returned value will need to be asserted to the correct type.

Types

type IDeepCopy added in v3.32.0

type IDeepCopy interface {
	DeepCopy() interface{}
}

IDeepCopy for delegating copy process to type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL