mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#852)
bumping knative.dev/pkg 1ca1f09...5fe2303: > 5fe2303 drop vendor licenses (# 3001) > f69f148 Optionally generate an init func for an informer (# 2989) > b8b7ca1 upgrade to latest dependencies (# 3000) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
7bc8b275e9
commit
84717c027d
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
|||
k8s.io/code-generator v0.29.2
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
|
||||
knative.dev/hack v0.0.0-20240327150553-47368d631660
|
||||
knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e
|
||||
knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
4
go.sum
4
go.sum
|
@ -674,8 +674,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
|
|||
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
knative.dev/hack v0.0.0-20240327150553-47368d631660 h1:tW6NgyjMnSXBS75+k+Xh5uNiLhJ9TFswS9hrkC3OQOc=
|
||||
knative.dev/hack v0.0.0-20240327150553-47368d631660/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||
knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e h1:Cg28hbL35g5Qd3tC0PKSX2FMMD8IZnTYxRr4VLIUgd8=
|
||||
knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e/go.mod h1:uYSh5G3A/pFmzgowpvKeyphLbXVkY4x7zEhReKwsVeU=
|
||||
knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a h1:HYKynG9QjRuVxrXEYnSMWBXboyOqHBgoQZt0xe4+RMA=
|
||||
knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a/go.mod h1:LgcT4KPEcw24alWzzkFAN2acHq38au8NZqybU16TStI=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
|
|
|
@ -30,6 +30,7 @@ type CustomArgs struct {
|
|||
ListersPackage string
|
||||
ForceKinds string
|
||||
ListerHasPointerElem bool
|
||||
DisableInformerInit bool
|
||||
}
|
||||
|
||||
// NewDefaults returns default arguments for the generator.
|
||||
|
@ -49,6 +50,8 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
|||
|
||||
fs.BoolVar(&ca.ListerHasPointerElem, "lister-has-pointer-elem", false, "")
|
||||
fs.MarkDeprecated("lister-has-pointer-elem", "this flag has no effect")
|
||||
|
||||
fs.BoolVar(&ca.DisableInformerInit, "disable-informer-init", false, "disable generating the init function for the informer")
|
||||
}
|
||||
|
||||
// Validate checks the given arguments.
|
||||
|
|
|
@ -37,6 +37,7 @@ type injectionGenerator struct {
|
|||
imports namer.ImportTracker
|
||||
typedInformerPackage string
|
||||
groupInformerFactoryPackage string
|
||||
disableInformerInit bool
|
||||
}
|
||||
|
||||
var _ generator.Generator = (*injectionGenerator)(nil)
|
||||
|
@ -98,6 +99,7 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w
|
|||
Package: "context",
|
||||
Name: "WithValue",
|
||||
}),
|
||||
"disableInformerInit": g.disableInformerInit,
|
||||
}
|
||||
|
||||
sw.Do(injectionInformer, m)
|
||||
|
@ -106,14 +108,16 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w
|
|||
}
|
||||
|
||||
var injectionInformer = `
|
||||
{{ if not .disableInformerInit }}
|
||||
func init() {
|
||||
{{.injectionRegisterInformer|raw}}(withInformer)
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
// Key is used for associating the Informer inside the context.Context.
|
||||
type Key struct{}
|
||||
|
||||
func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.controllerInformer|raw}}) {
|
||||
{{ if .disableInformerInit }} func WithInformer {{ else }} func withInformer {{ end }} (ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.controllerInformer|raw}}) {
|
||||
f := {{.factoryGet|raw}}(ctx)
|
||||
inf := f.{{.groupGoName}}().{{.versionGoName}}().{{.type|publicPlural}}()
|
||||
return {{ .contextWithValue|raw }}(ctx, Key{}, inf), inf.Informer()
|
||||
|
|
|
@ -412,6 +412,7 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg
|
|||
imports: generator.NewImportTracker(),
|
||||
typedInformerPackage: typedInformerPackage,
|
||||
groupInformerFactoryPackage: factoryPackagePath,
|
||||
disableInformerInit: customArgs.DisableInformerInit,
|
||||
})
|
||||
return generators
|
||||
},
|
||||
|
|
|
@ -695,7 +695,7 @@ k8s.io/utils/trace
|
|||
# knative.dev/hack v0.0.0-20240327150553-47368d631660
|
||||
## explicit; go 1.18
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e
|
||||
# knative.dev/pkg v0.0.0-20240328165227-5fe230325f5a
|
||||
## explicit; go 1.21
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
Loading…
Reference in New Issue