You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2019/11/28 07:40:50 UTC

[camel-k] 03/07: Fix #613: fix lint

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 2ef2ec56325b24d9c75cfc1e570d5eb3751b58c4
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Sat Nov 23 20:58:07 2019 +0100

    Fix #613: fix lint
---
 pkg/apis/camel/v1alpha1/integrationplatform_types.go | 1 -
 pkg/cmd/install.go                                   | 4 ++--
 pkg/install/common.go                                | 8 ++++----
 pkg/install/operator.go                              | 1 +
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/integrationplatform_types.go b/pkg/apis/camel/v1alpha1/integrationplatform_types.go
index bfd7cf1..3e17daf 100644
--- a/pkg/apis/camel/v1alpha1/integrationplatform_types.go
+++ b/pkg/apis/camel/v1alpha1/integrationplatform_types.go
@@ -81,7 +81,6 @@ const (
 // AllIntegrationPlatformClusters --
 var AllIntegrationPlatformClusters = []IntegrationPlatformCluster{IntegrationPlatformClusterOpenShift, IntegrationPlatformClusterKubernetes}
 
-
 // TraitProfile represents lists of traits that are enabled for the specific installation/integration
 type TraitProfile string
 
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index e448a08..35199a5 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -104,12 +104,12 @@ type installCmdOptions struct {
 	*RootCmdOptions
 	wait              bool
 	clusterSetupOnly  bool
-	clusterType       string
 	skipOperatorSetup bool
 	skipClusterSetup  bool
 	exampleSetup      bool
 	global            bool
 	kanikoBuildCache  bool
+	clusterType       string
 	outputFormat      string
 	camelVersion      string
 	runtimeVersion    string
@@ -261,7 +261,7 @@ func (o *installCmdOptions) install(cobraCmd *cobra.Command, _ []string) error {
 
 		if o.clusterType != "" {
 			for _, c := range v1alpha1.AllIntegrationPlatformClusters {
-				if strings.ToLower(string(c)) == strings.ToLower(o.clusterType) {
+				if strings.EqualFold(string(c), o.clusterType) {
 					platform.Spec.Cluster = c
 				}
 			}
diff --git a/pkg/install/common.go b/pkg/install/common.go
index a9d36c7..f07f279 100644
--- a/pkg/install/common.go
+++ b/pkg/install/common.go
@@ -26,6 +26,7 @@ import (
 	"github.com/apache/camel-k/pkg/client"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/openshift"
+	kube "k8s.io/client-go/kubernetes"
 
 	"k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -114,12 +115,11 @@ func RuntimeObjectOrCollect(ctx context.Context, c client.Client, namespace stri
 	return err
 }
 
-
-func isOpenShift(c client.Client, clusterType string) (bool, error) {
+func isOpenShift(c kube.Interface, clusterType string) (bool, error) {
 	var res bool
 	var err error
 	if clusterType != "" {
-		res = strings.ToLower(clusterType) == strings.ToLower(string(v1alpha1.IntegrationPlatformClusterOpenShift))
+		res = strings.EqualFold(clusterType, string(v1alpha1.IntegrationPlatformClusterOpenShift))
 	} else {
 		res, err = openshift.IsOpenShift(c)
 		if err != nil {
@@ -127,4 +127,4 @@ func isOpenShift(c client.Client, clusterType string) (bool, error) {
 		}
 	}
 	return res, nil
-}
\ No newline at end of file
+}
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index eb17081..d4b97c8 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -153,6 +153,7 @@ func installKnative(ctx context.Context, c client.Client, namespace string, cust
 }
 
 // Platform installs the platform custom resource
+// nolint: lll
 func Platform(ctx context.Context, c client.Client, clusterType string, namespace string, registry v1alpha1.IntegrationPlatformRegistrySpec) (*v1alpha1.IntegrationPlatform, error) {
 	return PlatformOrCollect(ctx, c, clusterType, namespace, registry, nil)
 }