mirror of https://github.com/k3s-io/k3s
bump(k8s.io/gengo): b58fc7edb82e0c6ffc9b8aef61813c7261b785d4
parent
1a4a019e5f
commit
729f5a3b4d
|
@ -1834,7 +1834,6 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/inconshreveable/mousetrap",
|
||||
"Comment": "v1.0",
|
||||
"Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||
},
|
||||
{
|
||||
|
@ -2313,7 +2312,6 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/pelletier/go-buffruneio",
|
||||
"Comment": "v0.1.0",
|
||||
"Rev": "df1e16fde7fc330a0ca68167c23bf7ed6ac31d6d"
|
||||
},
|
||||
{
|
||||
|
@ -2632,7 +2630,6 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/xiang90/probing",
|
||||
"Comment": "0.0.1",
|
||||
"Rev": "07dd2e8dfe18522e9c447ba95f2fe95262f63bb2"
|
||||
},
|
||||
{
|
||||
|
@ -3007,43 +3004,43 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/args",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/deepcopy-gen/generators",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/defaulter-gen/generators",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/import-boss/generators",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/set-gen/generators",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/set-gen/sets",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/generator",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/namer",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/parser",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/types",
|
||||
"Rev": "70ad626ed2d7a483d89d2c4c56364d60b48ee8fc"
|
||||
"Rev": "b58fc7edb82e0c6ffc9b8aef61813c7261b785d4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/heapster/metrics/api/v1/types",
|
||||
|
|
|
@ -369,60 +369,7 @@ func argsFromType(ts ...*types.Type) generator.Args {
|
|||
}
|
||||
|
||||
func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error {
|
||||
glog.V(5).Infof("Registering types in pkg %q", g.targetPackage)
|
||||
|
||||
// the legacy restration will go away when the cloner is removed from Kubernetes, replaced
|
||||
// with static function calls to the DeepCopy methods.
|
||||
return g.legacyRegistration(c, w)
|
||||
}
|
||||
|
||||
func (g *genDeepCopy) legacyRegistration(c *generator.Context, w io.Writer) error {
|
||||
conversionPackagePath := "k8s.io/apimachinery/pkg/conversion"
|
||||
runtimePackagePath := "k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
cloner := c.Universe.Type(types.Name{Package: conversionPackagePath, Name: "Cloner"})
|
||||
g.imports.AddType(cloner)
|
||||
if !g.registerTypes {
|
||||
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
||||
sw.Do("// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.\n", nil)
|
||||
sw.Do("//\n", nil)
|
||||
sw.Do("// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.\n", nil)
|
||||
sw.Do("func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc{\n", nil)
|
||||
sw.Do("return []conversion.GeneratedDeepCopyFunc{\n", nil)
|
||||
for _, t := range g.typesForInit {
|
||||
args := argsFromType(t).
|
||||
With("typeof", c.Universe.Package("reflect").Function("TypeOf"))
|
||||
sw.Do("{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {in.(*$.type|raw$).DeepCopyInto(out.(*$.type|raw$)); return nil}, InType: $.typeof|raw$(&$.type|raw${})},\n", args)
|
||||
}
|
||||
sw.Do("}\n", nil)
|
||||
sw.Do("}\n\n", nil)
|
||||
return sw.Error()
|
||||
}
|
||||
|
||||
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
||||
sw.Do("func init() {\n", nil)
|
||||
sw.Do("SchemeBuilder.Register(RegisterDeepCopies)\n", nil)
|
||||
sw.Do("}\n\n", nil)
|
||||
|
||||
scheme := c.Universe.Type(types.Name{Package: runtimePackagePath, Name: "Scheme"})
|
||||
schemePtr := &types.Type{
|
||||
Kind: types.Pointer,
|
||||
Elem: scheme,
|
||||
}
|
||||
sw.Do("// RegisterDeepCopies adds deep-copy functions to the given scheme. Public\n", nil)
|
||||
sw.Do("// to allow building arbitrary schemes.\n", nil)
|
||||
sw.Do("//\n", nil)
|
||||
sw.Do("// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.\n", nil)
|
||||
sw.Do("func RegisterDeepCopies(scheme $.|raw$) error {\n", schemePtr)
|
||||
sw.Do("return scheme.AddGeneratedDeepCopyFuncs(\n", nil)
|
||||
for _, t := range g.typesForInit {
|
||||
args := argsFromType(t).
|
||||
With("typeof", c.Universe.Package("reflect").Function("TypeOf"))
|
||||
sw.Do("conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {in.(*$.type|raw$).DeepCopyInto(out.(*$.type|raw$)); return nil}, InType: $.typeof|raw$(&$.type|raw${})},\n", args)
|
||||
}
|
||||
sw.Do(")\n", nil)
|
||||
sw.Do("}\n\n", nil)
|
||||
return sw.Error()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *genDeepCopy) needsGeneration(t *types.Type) bool {
|
||||
|
|
|
@ -189,7 +189,7 @@ type Empty struct{}
|
|||
var setCode = `// sets.$.type|public$ is a set of $.type|raw$s, implemented via map[$.type|raw$]struct{} for minimal memory consumption.
|
||||
type $.type|public$ map[$.type|raw$]Empty
|
||||
|
||||
// New creates a $.type|public$ from a list of values.
|
||||
// New$.type|public$ creates a $.type|public$ from a list of values.
|
||||
func New$.type|public$(items ...$.type|raw$) $.type|public$ {
|
||||
ss := $.type|public${}
|
||||
ss.Insert(items...)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
// sets.Byte is a set of bytes, implemented via map[byte]struct{} for minimal memory consumption.
|
||||
type Byte map[byte]Empty
|
||||
|
||||
// New creates a Byte from a list of values.
|
||||
// NewByte creates a Byte from a list of values.
|
||||
func NewByte(items ...byte) Byte {
|
||||
ss := Byte{}
|
||||
ss.Insert(items...)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
// sets.Int is a set of ints, implemented via map[int]struct{} for minimal memory consumption.
|
||||
type Int map[int]Empty
|
||||
|
||||
// New creates a Int from a list of values.
|
||||
// NewInt creates a Int from a list of values.
|
||||
func NewInt(items ...int) Int {
|
||||
ss := Int{}
|
||||
ss.Insert(items...)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
// sets.Int64 is a set of int64s, implemented via map[int64]struct{} for minimal memory consumption.
|
||||
type Int64 map[int64]Empty
|
||||
|
||||
// New creates a Int64 from a list of values.
|
||||
// NewInt64 creates a Int64 from a list of values.
|
||||
func NewInt64(items ...int64) Int64 {
|
||||
ss := Int64{}
|
||||
ss.Insert(items...)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
// sets.String is a set of strings, implemented via map[string]struct{} for minimal memory consumption.
|
||||
type String map[string]Empty
|
||||
|
||||
// New creates a String from a list of values.
|
||||
// NewString creates a String from a list of values.
|
||||
func NewString(items ...string) String {
|
||||
ss := String{}
|
||||
ss.Insert(items...)
|
||||
|
|
Loading…
Reference in New Issue