You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/11/30 03:54:56 UTC

[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 <sa...@gmail.com>
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