This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 45d976e792f13df46230c6159d26358e70952c79 Author: phantomjinx <[email protected]> AuthorDate: Fri Apr 29 16:23:46 2022 +0100 chore: Fixes linter issues --- pkg/trait/trait.go | 14 ++++++++------ pkg/util/defaults/defaults.go | 2 +- pkg/util/knative/apis.go | 10 +++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pkg/trait/trait.go b/pkg/trait/trait.go index 0158b78a4..98f8ef706 100644 --- a/pkg/trait/trait.go +++ b/pkg/trait/trait.go @@ -35,11 +35,12 @@ import ( func Apply(ctx context.Context, c client.Client, integration *v1.Integration, kit *v1.IntegrationKit) (*Environment, error) { var ilog log.Logger - if integration != nil { + switch { + case integration != nil: ilog = log.ForIntegration(integration) - } else if kit != nil { + case kit != nil: ilog = log.ForIntegrationKit(kit) - } else { + default: ilog = log.WithValues("Function", "trait.Apply") } @@ -66,11 +67,12 @@ func Apply(ctx context.Context, c client.Client, integration *v1.Integration, ki } } - if integration != nil { + switch { + case integration != nil: ilog.Debug("Applied traits to Integration", "integration", integration.Name, "namespace", integration.Namespace) - } else if kit != nil { + case kit != nil: ilog.Debug("Applied traits to Integration kit", "integration kit", kit.Name, "namespace", kit.Namespace) - } else { + default: ilog.Debug("Applied traits") } return environment, nil diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go index e36b214b4..e6ba7de4c 100644 --- a/pkg/util/defaults/defaults.go +++ b/pkg/util/defaults/defaults.go @@ -47,5 +47,5 @@ const ( installDefaultKamelets = true ) -//GitCommit must be provided during application build +// GitCommit must be provided during application build var GitCommit string diff --git a/pkg/util/knative/apis.go b/pkg/util/knative/apis.go index 2dffb8f15..a39a6ce12 100644 --- a/pkg/util/knative/apis.go +++ b/pkg/util/knative/apis.go @@ -206,29 +206,29 @@ func GetServiceType(ref v1.ObjectReference) (*knativev1.CamelServiceType, error) return nil, nil } -// nolint: gocritic func fillMissingReferenceDataWith(serviceTypes []GroupVersionKindResource, ref v1.ObjectReference) []v1.ObjectReference { list := make([]v1.ObjectReference, 0) - if ref.APIVersion == "" && ref.Kind == "" { + switch { + case ref.APIVersion == "" && ref.Kind == "": for _, st := range serviceTypes { refCopy := ref.DeepCopy() refCopy.APIVersion = st.GroupVersion().String() refCopy.Kind = st.Kind list = append(list, *refCopy) } - } else if ref.APIVersion == "" { + case ref.APIVersion == "": for _, gv := range getGroupVersions(serviceTypes, ref.Kind) { refCopy := ref.DeepCopy() refCopy.APIVersion = gv list = append(list, *refCopy) } - } else if ref.Kind == "" { + case ref.Kind == "": for _, k := range getKinds(serviceTypes, ref.APIVersion) { refCopy := ref.DeepCopy() refCopy.Kind = k list = append(list, *refCopy) } - } else { + default: list = append(list, ref) } return list
