[camel-k] 02/05: chore: polish
This is an automated email from the ASF dual-hosted git repository. tsato pushed a commit to branch release-1.10.x in repository https://gitbox.apache.org/repos/asf/camel-k.git commit 8ffc3459dd8b736c43ac2ce74361d90447360682 Author: Tadayoshi Sato AuthorDate: Tue Nov 29 14:44:24 2022 +0900 chore: polish --- pkg/apis/camel/v1/camelcatalog_types_support.go | 10 +- pkg/util/camel/camel_runtime_catalog.go | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/apis/camel/v1/camelcatalog_types_support.go b/pkg/apis/camel/v1/camelcatalog_types_support.go index 9c0ba615b..89c4c16eb 100644 --- a/pkg/apis/camel/v1/camelcatalog_types_support.go +++ b/pkg/apis/camel/v1/camelcatalog_types_support.go @@ -74,20 +74,20 @@ func (in *CamelArtifact) GetDependencyID() string { } } -func (in *CamelArtifact) GetConsumerDependencyIDs(schemeID string) (deps []string) { +func (in *CamelArtifact) GetConsumerDependencyIDs(schemeID string) []string { return in.getDependencyIDs(schemeID, consumerScheme) } -func (in *CamelArtifact) GetProducerDependencyIDs(schemeID string) (deps []string) { +func (in *CamelArtifact) GetProducerDependencyIDs(schemeID string) []string { return in.getDependencyIDs(schemeID, producerScheme) } -func (in *CamelArtifact) getDependencyIDs(schemeID string, scope func(CamelScheme) CamelSchemeScope) (deps []string) { +func (in *CamelArtifact) getDependencyIDs(schemeID string, scope func(CamelScheme) CamelSchemeScope) []string { ads := in.getDependencies(schemeID, scope) if ads == nil { - return deps + return nil } - deps = make([]string, 0, len(ads)) + deps := make([]string, 0, len(ads)) for _, ad := range ads { deps = append(deps, ad.GetDependencyID()) } diff --git a/pkg/util/camel/camel_runtime_catalog.go b/pkg/util/camel/camel_runtime_catalog.go index 511541911..28e52e4f6 100644 --- a/pkg/util/camel/camel_runtime_catalog.go +++ b/pkg/util/camel/camel_runtime_catalog.go @@ -159,9 +159,8 @@ func (c *RuntimeCatalog) DecodeComponent(uri string) (*v1.CamelArtifact, *v1.Cam return nil, nil } uriStart := uriSplit[0] - scheme, ok := c.GetScheme(uriStart) var schemeRef *v1.CamelScheme - if ok { + if scheme, ok := c.GetScheme(uriStart); ok { schemeRef = &scheme } return c.GetArtifactByScheme(uriStart), schemeRef
[camel-k] 02/05: chore: polish
This is an automated email from the ASF dual-hosted git repository. tsato pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git commit 6374977a8759e286420207a3d51c44024ee3e783 Author: Tadayoshi Sato AuthorDate: Tue Nov 29 14:44:24 2022 +0900 chore: polish --- pkg/apis/camel/v1/camelcatalog_types_support.go | 10 +- pkg/util/camel/camel_runtime_catalog.go | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/apis/camel/v1/camelcatalog_types_support.go b/pkg/apis/camel/v1/camelcatalog_types_support.go index 1106a8b51..3434e255b 100644 --- a/pkg/apis/camel/v1/camelcatalog_types_support.go +++ b/pkg/apis/camel/v1/camelcatalog_types_support.go @@ -101,20 +101,20 @@ func (in *CamelArtifact) GetDependencyID() string { } } -func (in *CamelArtifact) GetConsumerDependencyIDs(schemeID string) (deps []string) { +func (in *CamelArtifact) GetConsumerDependencyIDs(schemeID string) []string { return in.getDependencyIDs(schemeID, consumerScheme) } -func (in *CamelArtifact) GetProducerDependencyIDs(schemeID string) (deps []string) { +func (in *CamelArtifact) GetProducerDependencyIDs(schemeID string) []string { return in.getDependencyIDs(schemeID, producerScheme) } -func (in *CamelArtifact) getDependencyIDs(schemeID string, scope func(CamelScheme) CamelSchemeScope) (deps []string) { +func (in *CamelArtifact) getDependencyIDs(schemeID string, scope func(CamelScheme) CamelSchemeScope) []string { ads := in.getDependencies(schemeID, scope) if ads == nil { - return deps + return nil } - deps = make([]string, 0, len(ads)) + deps := make([]string, 0, len(ads)) for _, ad := range ads { deps = append(deps, ad.GetDependencyID()) } diff --git a/pkg/util/camel/camel_runtime_catalog.go b/pkg/util/camel/camel_runtime_catalog.go index 25da254e4..3305bd10b 100644 --- a/pkg/util/camel/camel_runtime_catalog.go +++ b/pkg/util/camel/camel_runtime_catalog.go @@ -186,9 +186,8 @@ func (c *RuntimeCatalog) DecodeComponent(uri string) (*v1.CamelArtifact, *v1.Cam return nil, nil } uriStart := uriSplit[0] - scheme, ok := c.GetScheme(uriStart) var schemeRef *v1.CamelScheme - if ok { + if scheme, ok := c.GetScheme(uriStart); ok { schemeRef = &scheme } return c.GetArtifactByScheme(uriStart), schemeRef