Version: v0.0.0-...-9d8b5e1 Latest Latest

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 3 Imported by: 1



Package clone contains the implementation of the clone plugin, which generates the deriveClone function.

The deriveClone function is a maintainable and fast way to implement fast"ish" clone functions.

func deriveClone(T) T

I say fast"ish", since deriveClone creates a totally new copy of the value, whereas deepcopy reuses as much as of the memory that has been allocated by the destintation value.

Supported types:

  • basic types
  • named structs
  • slices
  • maps
  • pointers to these types
  • private fields of structs in external packages (using reflect and unsafe)
  • and many more

Unsupported types:

  • chan
  • interface
  • function
  • unnamed structs, which are not comparable with the == operator



This section is empty.


This section is empty.


func New

New is a constructor for the clone code generator. This generator should be reconstructed for each package.

func NewPlugin

func NewPlugin() derive.Plugin

NewPlugin creates a new clone plugin. This function returns the plugin name, default prefix and a constructor for the clone code generator.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

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