controller-tools: sigs.k8s.io/controller-tools/pkg/deepcopy Index | Files

package deepcopy

import "sigs.k8s.io/controller-tools/pkg/deepcopy"

Package deepcopy generates DeepCopy, DeepCopyInto, and DeepCopyObject implementations for types.

It's ported from k8s.io/code-generator's / k8s.io/gengo's deepcopy-gen, but it's scoped specifically to runtime.Object and skips support for deepcopying interfaces, which aren't handled in CRDs anyway.

Index

Package Files

doc.go gen.go traverse.go zz_generated.markerhelp.go

type Generator Uses

type Generator struct {
    // HeaderFile specifies the header text (e.g. license) to prepend to generated files.
    HeaderFile string `marker:",optional"`
    // Year specifies the year to substitute for " YEAR" in the header file.
    Year string `marker:",optional"`
}

Generator generates code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

func (Generator) Generate Uses

func (d Generator) Generate(ctx *genall.GenerationContext) error

func (Generator) Help Uses

func (Generator) Help() *markers.DefinitionHelp

func (Generator) RegisterMarkers Uses

func (Generator) RegisterMarkers(into *markers.Registry) error

type ObjectGenCtx Uses

type ObjectGenCtx struct {
    Collector  *markers.Collector
    Checker    *loader.TypeChecker
    HeaderText string
}

ObjectGenCtx contains the common info for generating deepcopy implementations. It mostly exists so that generating for a package can be easily tested without requiring a full set of output rules, etc.

func (*ObjectGenCtx) GenerateForPackage Uses

func (ctx *ObjectGenCtx) GenerateForPackage(root *loader.Package) []byte

GenerateForPackage generates DeepCopy and runtime.Object implementations for types in the given package, writing the formatted result to given writer. May return nil if source could not be generated.

Package deepcopy imports 14 packages (graph) and is imported by 2 packages. Updated 2019-11-16. Refresh now. Tools for package owners.