Align linters with serving (enables stylecheck and asciicheck) (#1738)

This commit is contained in:
Markus Thömmes 2020-09-23 16:37:40 +02:00 committed by GitHub
parent 58028584ae
commit 5fbbde31b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 97 additions and 88 deletions

View File

@ -7,8 +7,10 @@ run:
linters:
enable:
- asciicheck
- gosec
- prealloc
- stylecheck
- unconvert
- unparam
disable:

View File

@ -234,7 +234,7 @@ func (r conditionsImpl) ClearCondition(t ConditionType) error {
}
// Terminal conditions are not handled as they can't be nil
if r.isTerminal(t) {
return fmt.Errorf("Clearing terminal conditions not implemented")
return fmt.Errorf("clearing terminal conditions not implemented")
}
cond := r.GetCondition(t)
if cond == nil {

View File

@ -118,11 +118,11 @@ func TestCheckDeprecated(t *testing.T) {
"create strict, not json": {
strict: true,
obj: &InnerDefaultSubSpec{
DeprecatedNotJson: "fail",
DeprecatedNotJSON: "fail",
},
wantErrs: []string{
"must not set",
"DeprecatedNotJson",
"DeprecatedNotJSON",
},
},
"create strict, inlined": {

View File

@ -393,11 +393,11 @@ func (*Patch) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *Patch) DeepCopyObject() runtime.Object {
func (*Patch) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *Patch) GetListType() runtime.Object {
func (*Patch) GetListType() runtime.Object {
return nil // not used
}

View File

@ -54,11 +54,11 @@ func (*Scalable) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *Scalable) DeepCopyObject() runtime.Object {
func (*Scalable) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *Scalable) GetListType() runtime.Object {
func (*Scalable) GetListType() runtime.Object {
return nil // not used
}

View File

@ -35,11 +35,11 @@ type Destination struct {
// Validate the Destination has all the necessary fields and check the
// Namespace matches that of the parent object (using apis.ParentMeta).
func (dest *Destination) Validate(ctx context.Context) *apis.FieldError {
if dest == nil {
func (d *Destination) Validate(ctx context.Context) *apis.FieldError {
if d == nil {
return nil
}
return ValidateDestination(ctx, *dest).ViaField(apis.CurrentField)
return ValidateDestination(ctx, *d).ViaField(apis.CurrentField)
}
// ValidateDestination validates Destination.
@ -65,11 +65,11 @@ func ValidateDestination(ctx context.Context, dest Destination) *apis.FieldError
// GetRef gets the KReference from this Destination, if one is present. If no ref is present,
// then nil is returned.
func (dest *Destination) GetRef() *KReference {
if dest == nil {
func (d *Destination) GetRef() *KReference {
if d == nil {
return nil
}
return dest.Ref
return d.Ref
}
func (d *Destination) SetDefaults(ctx context.Context) {

View File

@ -89,15 +89,15 @@ func (s *Status) GetCondition(t apis.ConditionType) *apis.Condition {
// By default apis.ConditionReady and apis.ConditionSucceeded will be copied over to the
// sink. Other conditions types are tested against a list of predicates. If any of the predicates
// return true the condition type will be copied to the sink
func (source *Status) ConvertTo(ctx context.Context, sink *Status, predicates ...func(apis.ConditionType) bool) {
sink.ObservedGeneration = source.ObservedGeneration
if source.Annotations != nil {
func (s *Status) ConvertTo(ctx context.Context, sink *Status, predicates ...func(apis.ConditionType) bool) {
sink.ObservedGeneration = s.ObservedGeneration
if s.Annotations != nil {
// This will deep copy the map.
sink.Annotations = kmeta.UnionMaps(source.Annotations)
sink.Annotations = kmeta.UnionMaps(s.Annotations)
}
conditions := make(apis.Conditions, 0, len(source.Conditions))
for _, c := range source.Conditions {
conditions := make(apis.Conditions, 0, len(s.Conditions))
for _, c := range s.Conditions {
// Copy over the "happy" condition, which is the only condition that
// we can reliably transfer.

View File

@ -106,13 +106,13 @@ func (s *Status) GetCondition(t apis.ConditionType) *apis.Condition {
}
// ConvertTo helps implement apis.Convertible for types embedding this Status.
func (source *Status) ConvertTo(ctx context.Context, sink *Status) {
sink.ObservedGeneration = source.ObservedGeneration
if source.Annotations != nil {
func (s *Status) ConvertTo(ctx context.Context, sink *Status) {
sink.ObservedGeneration = s.ObservedGeneration
if s.Annotations != nil {
// This will deep copy the map.
sink.Annotations = kmeta.UnionMaps(source.Annotations)
sink.Annotations = kmeta.UnionMaps(s.Annotations)
}
for _, c := range source.Conditions {
for _, c := range s.Conditions {
switch c.Type {
// Copy over the "happy" condition, which is the only condition that
// we can reliably transfer.

View File

@ -231,11 +231,11 @@ func (*Foo) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *Foo) DeepCopyObject() runtime.Object {
func (*Foo) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *Foo) GetListType() runtime.Object {
func (*Foo) GetListType() runtime.Object {
return nil // not used
}
@ -270,11 +270,11 @@ func (*Bar) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *Bar) DeepCopyObject() runtime.Object {
func (*Bar) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *Bar) GetListType() runtime.Object {
func (*Bar) GetListType() runtime.Object {
return nil // not used
}
@ -309,11 +309,11 @@ func (*Slice) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *Slice) DeepCopyObject() runtime.Object {
func (*Slice) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *Slice) GetListType() runtime.Object {
func (*Slice) GetListType() runtime.Object {
return nil // not used
}
@ -341,11 +341,11 @@ func (*String) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *String) DeepCopyObject() runtime.Object {
func (*String) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *String) GetListType() runtime.Object {
func (*String) GetListType() runtime.Object {
return nil // not used
}
@ -371,11 +371,11 @@ func (*UnableToMarshal) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *UnableToMarshal) DeepCopyObject() runtime.Object {
func (*UnableToMarshal) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *UnableToMarshal) GetListType() runtime.Object {
func (*UnableToMarshal) GetListType() runtime.Object {
return nil // not used
}
@ -383,10 +383,10 @@ func (u *UnableToMarshal) GetFullType() Populatable {
return u
}
func (u *UnableToMarshal) Populate() {
func (*UnableToMarshal) Populate() {
}
func (u *UnableToMarshal) MarshalJSON() ([]byte, error) {
func (*UnableToMarshal) MarshalJSON() ([]byte, error) {
return nil, errors.New("I will never marshal for you")
}
@ -401,11 +401,11 @@ func (*UnableToUnmarshal) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *UnableToUnmarshal) DeepCopyObject() runtime.Object {
func (*UnableToUnmarshal) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *UnableToUnmarshal) GetListType() runtime.Object {
func (*UnableToUnmarshal) GetListType() runtime.Object {
return nil // not used
}
@ -413,10 +413,10 @@ func (u *UnableToUnmarshal) GetFullType() Populatable {
return u
}
func (u *UnableToUnmarshal) Populate() {
func (*UnableToUnmarshal) Populate() {
}
func (u *UnableToUnmarshal) UnmarshalJSON([]byte) error {
func (*UnableToUnmarshal) UnmarshalJSON([]byte) error {
return errors.New("I will never unmarshal for you")
}
@ -433,15 +433,15 @@ func (*UnexportedFields) GetObjectKind() schema.ObjectKind {
return nil // not used
}
func (p *UnexportedFields) DeepCopyObject() runtime.Object {
func (*UnexportedFields) DeepCopyObject() runtime.Object {
return nil // not used
}
func (p *UnexportedFields) GetListType() runtime.Object {
func (*UnexportedFields) GetListType() runtime.Object {
return nil // not used
}
func (u *UnexportedFields) GetFullType() Populatable {
func (*UnexportedFields) GetFullType() Populatable {
return &UnexportedFields{}
}

View File

@ -505,7 +505,7 @@ func (c *Impl) processNextWorkItem() bool {
// Embed the key into the logger and attach that to the context we pass
// to the Reconciler.
logger := c.logger.With(zap.String(logkey.TraceId, uuid.New().String()), zap.String(logkey.Key, keyStr))
logger := c.logger.With(zap.String(logkey.TraceID, uuid.New().String()), zap.String(logkey.Key, keyStr))
ctx := logging.WithLogger(context.Background(), logger)
// Run Reconcile, passing it the namespace/name string of the

View File

@ -92,7 +92,7 @@ func (cs *configMapKVStore) Get(ctx context.Context, key string, value interface
}
err := json.Unmarshal([]byte(v), value)
if err != nil {
return fmt.Errorf("Failed to Unmarshal %q: %v", v, err)
return fmt.Errorf("failed to Unmarshal %q: %v", v, err)
}
return nil
}
@ -101,7 +101,7 @@ func (cs *configMapKVStore) Get(ctx context.Context, key string, value interface
func (cs *configMapKVStore) Set(ctx context.Context, key string, value interface{}) error {
bytes, err := json.Marshal(value)
if err != nil {
return fmt.Errorf("Failed to Marshal: %v", err)
return fmt.Errorf("failed to Marshal: %v", err)
}
cs.data[key] = string(bytes)
return nil

View File

@ -240,6 +240,7 @@ func ConfigMapName() string {
// JsonToLoggingConfig converts a json string of a Config.
// Returns a non-nil Config always.
// nolint:stylecheck // No rename due to backwards incompatibility.
func JsonToLoggingConfig(jsonCfg string) (*Config, error) {
if jsonCfg == "" {
return nil, errEmptyJSONLogginString
@ -259,6 +260,7 @@ func JsonToLoggingConfig(jsonCfg string) (*Config, error) {
}
// LoggingConfigToJson converts a Config to a json string.
// nolint:stylecheck // No rename due to backwards incompatibility.
func LoggingConfigToJson(cfg *Config) (string, error) {
if cfg == nil || cfg.LoggingConfig == "" {
return "", nil

View File

@ -23,8 +23,8 @@ const (
// Key is the key (namespace/name) being reconciled.
Key = "knative.dev/key"
// TraceId is the key used to track an asynchronous or long running operation.
TraceId = "knative.dev/traceid"
// TraceID is the key used to track an asynchronous or long running operation.
TraceID = "knative.dev/traceid"
// Namespace is the key used for namespace in structured logs
Namespace = "knative.dev/namespace"

View File

@ -346,6 +346,7 @@ func prometheusPort() (int, error) {
// JsonToMetricsOptions converts a json string of a
// ExporterOptions. Returns a non-nil ExporterOptions always.
// nolint:stylecheck // No rename due to backwards incompatibility.
func JsonToMetricsOptions(jsonOpts string) (*ExporterOptions, error) {
var opts ExporterOptions
if jsonOpts == "" {
@ -360,6 +361,7 @@ func JsonToMetricsOptions(jsonOpts string) (*ExporterOptions, error) {
}
// MetricsOptionsToJson converts a ExporterOptions to a json string.
// nolint:stylecheck // No rename due to backwards incompatibility.
func MetricsOptionsToJson(opts *ExporterOptions) (string, error) {
if opts == nil {
return "", nil

View File

@ -51,7 +51,7 @@ const (
// secretDataFieldKey is the name of the k8s Secret field that contains the Secret's key.
secretDataFieldKey = "key.json"
// stackdriverApiTimeout is the timeout value of Stackdriver API service side.
stackdriverApiTimeout = 12 * time.Second
stackdriverAPITimeout = 12 * time.Second
)
var (
@ -193,7 +193,7 @@ func newStackdriverExporter(config *metricsConfig, logger *zap.SugaredLogger) (v
GetMetricPrefix: mpf,
ReportingInterval: config.reportingPeriod,
DefaultMonitoringLabels: &sd.Labels{},
Timeout: stackdriverApiTimeout,
Timeout: stackdriverAPITimeout,
BundleCountThreshold: TestOverrideBundleCount,
})
if err != nil {
@ -291,7 +291,7 @@ func getStackdriverExporterClientOptions(config *metricsConfig) ([]option.Client
// SetStackdriverSecretLocation must have been called by calling package for this to work.
if config.stackdriverClientConfig.UseSecret {
if config.secret == nil {
return co, fmt.Errorf("No secret provided for component %q; cannot use stackdriver-use-secret=true", config.component)
return co, fmt.Errorf("no secret provided for component %q; cannot use stackdriver-use-secret=true", config.component)
}
if opt, err := convertSecretToExporterOption(config.secret); err == nil {
@ -374,7 +374,7 @@ func convertSecretToExporterOption(secret *corev1.Secret) (option.ClientOption,
if data, ok := secret.Data[secretDataFieldKey]; ok {
return option.WithCredentialsJSON(data), nil
}
return nil, fmt.Errorf("Expected Secret to store key in data field named [%s]", secretDataFieldKey)
return nil, fmt.Errorf("expected Secret to store key in data field named [%s]", secretDataFieldKey)
}
// ensureKubeclient is the lazy initializer for kubeclient.

View File

@ -24,7 +24,7 @@ import (
// Event leverages go's 1.13 error wrapping.
type Event error
// Is reports whether any error in err's chain matches target.
// EventIs reports whether any error in err's chain matches target.
//
// The chain consists of err itself followed by the sequence of errors obtained by
// repeatedly calling Unwrap.
@ -34,7 +34,7 @@ type Event error
// (text from errors/wrap.go)
var EventIs = errors.Is
// As finds the first error in err's chain that matches target, and if so, sets
// EventAs finds the first error in err's chain that matches target, and if so, sets
// target to that error value and returns true.
//
// The chain consists of err itself followed by the sequence of errors obtained by

View File

@ -376,7 +376,7 @@ func (fgc *FakeGithubClient) AddCommitToPullRequest(org, repo string, ID int, SH
return fmt.Errorf("repo %s not exist", repo)
}
if _, ok = PRs[ID]; !ok {
return fmt.Errorf("Pull Request %d not exist", ID)
return fmt.Errorf("pull Request %d not exist", ID)
}
if _, ok = fgc.PRCommits[ID]; !ok {
fgc.PRCommits[ID] = make([]*github.RepositoryCommit, 0, 1)

View File

@ -29,7 +29,7 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/buffer"
. "go.uber.org/zap/zapcore"
"go.uber.org/zap/zapcore"
)
var (
@ -42,7 +42,7 @@ var (
)
func init() {
zap.RegisterEncoder("spew", func(encoderConfig EncoderConfig) (Encoder, error) {
zap.RegisterEncoder("spew", func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) {
return NewSpewEncoder(encoderConfig), nil
})
}
@ -54,21 +54,21 @@ func init() {
// designed to make human-readable log only and get the most information to the user on any data type.
//
// Code is mostly from console_encoder.go in zapcore.
func NewSpewEncoder(cfg EncoderConfig) *SpewEncoder {
func NewSpewEncoder(cfg zapcore.EncoderConfig) *SpewEncoder {
enc := SpewEncoder{}
enc.MapObjectEncoder = NewMapObjectEncoder()
enc.MapObjectEncoder = zapcore.NewMapObjectEncoder()
enc.EncoderConfig = &cfg
return &enc
}
// SpewEncoder implements zapcore.Encoder interface
type SpewEncoder struct {
*MapObjectEncoder
*EncoderConfig
*zapcore.MapObjectEncoder
*zapcore.EncoderConfig
}
// Implements zapcore.Encoder interface
func (enc *SpewEncoder) Clone() Encoder {
func (enc *SpewEncoder) Clone() zapcore.Encoder {
n := NewSpewEncoder(*(enc.EncoderConfig))
for k, v := range enc.Fields {
n.Fields[k] = v
@ -86,7 +86,7 @@ func putSliceEncoder(e *sliceArrayEncoder) {
}
// Implements zapcore.Encoder interface.
func (enc *SpewEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, error) {
func (enc *SpewEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error) {
line := _pool.Get()
// Could probably rewrite this portion and remove the copied
@ -106,7 +106,7 @@ func (enc *SpewEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
if nameEncoder == nil {
// Fall back to FullNameEncoder for backward compatibility.
nameEncoder = FullNameEncoder
nameEncoder = zapcore.FullNameEncoder
}
nameEncoder(ent.LoggerName, arr)
@ -140,19 +140,19 @@ func (enc *SpewEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
if enc.LineEnding != "" {
line.AppendString(enc.LineEnding)
} else {
line.AppendString(DefaultLineEnding)
line.AppendString(zapcore.DefaultLineEnding)
}
return line, nil
}
func (enc *SpewEncoder) writeContext(line *buffer.Buffer, extra []Field) {
func (enc *SpewEncoder) writeContext(line *buffer.Buffer, extra []zapcore.Field) {
if len(extra) == 0 && len(enc.Fields) == 0 {
return
}
// This could probably be more efficient, but .AddTo() is convenient
context := NewMapObjectEncoder()
context := zapcore.NewMapObjectEncoder()
for k, v := range enc.Fields {
context.Fields[k] = v
}

View File

@ -160,6 +160,7 @@ func (o *TLogger) interfacesToFields(things ...interface{}) []interface{} {
return fields
}
// nolint:stylecheck // Returning the error first is okay and expected here.
func (o *TLogger) errorWithRuntimeCheck(stringThenKeysAndValues ...interface{}) (error, string, []interface{}) {
if len(stringThenKeysAndValues) == 0 {
return nil, "", nil
@ -346,8 +347,8 @@ func (o *TLogger) cloneWithNewLogger(l *zap.Logger) *TLogger {
// If any are errors, it fails the subtest.
// Currently experimental and likely to be removed
func (o *TLogger) Collect(key string, value interface{}) {
list, has_key := o.errs[key]
if has_key {
list, hasKey := o.errs[key]
if hasKey {
list = append(list, value)
} else {
list = make([]interface{}, 1)

View File

@ -124,11 +124,11 @@ func RunQueryRange(ctx context.Context, logf logging.FormatLogger, promAPI v1.AP
// VectorValue gets the vector value from the value type
func VectorValue(val model.Value) (float64, error) {
if val.Type() != model.ValVector {
return 0, fmt.Errorf("Value type is %s. Expected: Valvector", val.String())
return 0, fmt.Errorf("value type is %s. Expected: Valvector", val.String())
}
value := val.(model.Vector)
if len(value) == 0 {
return 0, errors.New("Query returned no results")
return 0, errors.New("query returned no results")
}
return float64(value[0].Value), nil

View File

@ -95,7 +95,7 @@ func (tpa *TestPromAPI) Snapshot(context.Context, bool) (v1.SnapshotResult, erro
}
// Targets returns an overview of the current state of the Prometheus target discovery.
func (t *TestPromAPI) Targets(context.Context) (v1.TargetsResult, error) {
func (tpa *TestPromAPI) Targets(context.Context) (v1.TargetsResult, error) {
return v1.TargetsResult{}, nil
}

View File

@ -117,7 +117,7 @@ func SetupZipkinTracingFromConfigTracingOrFail(ctx context.Context, t testing.TB
func SetupZipkinTracing(ctx context.Context, kubeClientset *kubernetes.Clientset, logf logging.FormatLogger, zipkinRemotePort int, zipkinNamespace string) (err error) {
setupOnce.Do(func() {
if e := monitoring.CheckPortAvailability(zipkinRemotePort); e != nil {
err = fmt.Errorf("Zipkin port not available on the machine: %w", err)
err = fmt.Errorf("zipkin port not available on the machine: %w", err)
return
}

View File

@ -82,7 +82,7 @@ type InnerDefaultSubSpec struct {
*InlinedPtrStruct `json:",inline"`
// Deprecated: This field is deprecated.
DeprecatedNotJson string
DeprecatedNotJSON string
}
// Adding complication helper.

View File

@ -62,16 +62,16 @@ func (r *Resource) GetUntypedSpec() interface{} {
}
// SetDefaults sets the defaults on the object.
func (c *Resource) SetDefaults(ctx context.Context) {
c.Spec.SetDefaults(ctx)
func (r *Resource) SetDefaults(ctx context.Context) {
r.Spec.SetDefaults(ctx)
}
func (c *Resource) Validate(ctx context.Context) *apis.FieldError {
err := c.Spec.Validate(ctx).ViaField("spec")
func (r *Resource) Validate(ctx context.Context) *apis.FieldError {
err := r.Spec.Validate(ctx).ViaField("spec")
if apis.IsInUpdate(ctx) {
original := apis.GetBaseline(ctx).(*Resource)
err = err.Also(c.CheckImmutableFields(ctx, original))
err = err.Also(r.CheckImmutableFields(ctx, original))
}
return err
}
@ -111,21 +111,21 @@ func (cs *ResourceSpec) Validate(ctx context.Context) *apis.FieldError {
return nil
}
func (current *Resource) CheckImmutableFields(ctx context.Context, original *Resource) *apis.FieldError {
if original.Spec.FieldThatsImmutable != current.Spec.FieldThatsImmutable {
func (r *Resource) CheckImmutableFields(ctx context.Context, original *Resource) *apis.FieldError {
if original.Spec.FieldThatsImmutable != r.Spec.FieldThatsImmutable {
return &apis.FieldError{
Message: "Immutable field changed",
Paths: []string{"spec.fieldThatsImmutable"},
Details: fmt.Sprintf("got: %v, want: %v", current.Spec.FieldThatsImmutable,
Details: fmt.Sprintf("got: %v, want: %v", r.Spec.FieldThatsImmutable,
original.Spec.FieldThatsImmutable),
}
}
if original.Spec.FieldThatsImmutableWithDefault != current.Spec.FieldThatsImmutableWithDefault {
if original.Spec.FieldThatsImmutableWithDefault != r.Spec.FieldThatsImmutableWithDefault {
return &apis.FieldError{
Message: "Immutable field changed",
Paths: []string{"spec.fieldThatsImmutableWithDefault"},
Details: fmt.Sprintf("got: %v, want: %v", current.Spec.FieldThatsImmutableWithDefault,
Details: fmt.Sprintf("got: %v, want: %v", r.Spec.FieldThatsImmutableWithDefault,
original.Spec.FieldThatsImmutableWithDefault),
}
}

View File

@ -66,7 +66,7 @@ func (c *FakeBoskosClient) ReleaseGKEProject(name string) error {
res.State = boskoscommon.Free
return nil
}
return fmt.Errorf("Got owner: %q, expect owner: %q", res.Owner, owner)
return fmt.Errorf("got owner: %q, expect owner: %q", res.Owner, owner)
}
}
return fmt.Errorf("resource doesn't exist yet: %q", name)

View File

@ -132,6 +132,7 @@ func NewTracingConfigFromConfigMap(config *corev1.ConfigMap) (*Config, error) {
// JsonToTracingConfig converts a json string of a Config.
// Returns a non-nil Config always and an eventual error.
// nolint:stylecheck // No rename due to backwards incompatibility.
func JsonToTracingConfig(jsonCfg string) (*Config, error) {
if jsonCfg == "" {
return defaultConfig(), errors.New("empty json tracing config")
@ -150,6 +151,7 @@ func JsonToTracingConfig(jsonCfg string) (*Config, error) {
}
// TracingConfigToJson converts a Config to a json string.
// nolint:stylecheck // No rename due to backwards incompatibility.
func TracingConfigToJson(cfg *Config) (string, error) {
if cfg == nil {
return "", nil

View File

@ -64,7 +64,7 @@ func MakeFactory(ctor Ctor) rtesting.Factory {
ctx = logging.WithLogger(ctx, logger)
ctx, kubeClient := fakekubeclient.With(ctx, ls.GetKubeObjects()...)
ctx, apixClient := fakeapixclient.With(ctx, ls.GetApiExtensionsObjects()...)
ctx, apixClient := fakeapixclient.With(ctx, ls.GetAPIExtensionsObjects()...)
ctx, dynamicClient := fakedynamicclient.With(ctx,
ls.NewScheme(), ToUnstructured(t, ls.NewScheme(), r.Objects)...)

View File

@ -98,8 +98,8 @@ func (l *Listers) GetDuckObjects() []runtime.Object {
return l.sorter.ObjectsForSchemeFunc(pkgducktesting.AddToScheme)
}
// GetApiExtensionsObjects filters the Listers initial list of objects to types definite in k8s.io/apiextensions
func (l *Listers) GetApiExtensionsObjects() []runtime.Object {
// GetAPIExtensionsObjects filters the Listers initial list of objects to types definite in k8s.io/apiextensions
func (l *Listers) GetAPIExtensionsObjects() []runtime.Object {
return l.sorter.ObjectsForSchemeFunc(fakeapix.AddToScheme)
}