camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nferr...@apache.org
Subject [camel-k] 03/03: chore(lint): make golangci-lint happy
Date Fri, 04 Jan 2019 09:12:04 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 692c4f11fc79b020c13a22206596bae80c2fb434
Author: nferraro <ni.ferraro@gmail.com>
AuthorDate: Fri Jan 4 09:39:43 2019 +0100

    chore(lint): make golangci-lint happy
---
 pkg/apis/camel/v1alpha1/types.go          | 1 +
 pkg/apis/camel/v1alpha1/types_support.go  | 2 +-
 pkg/stub/action/integration/initialize.go | 3 ++-
 pkg/trait/knative.go                      | 4 +++-
 pkg/trait/util.go                         | 2 +-
 pkg/util/source/inspector_xml.go          | 6 ++----
 6 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/types.go b/pkg/apis/camel/v1alpha1/types.go
index df2c251..09b46fa 100644
--- a/pkg/apis/camel/v1alpha1/types.go
+++ b/pkg/apis/camel/v1alpha1/types.go
@@ -21,6 +21,7 @@ import (
 	"github.com/apache/camel-k/pkg/util"
 	"github.com/mitchellh/mapstructure"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
 	"strings"
 )
 
diff --git a/pkg/apis/camel/v1alpha1/types_support.go b/pkg/apis/camel/v1alpha1/types_support.go
index 861223b..f73414c 100644
--- a/pkg/apis/camel/v1alpha1/types_support.go
+++ b/pkg/apis/camel/v1alpha1/types_support.go
@@ -19,9 +19,9 @@ package v1alpha1
 
 import (
 	"fmt"
-	"gopkg.in/yaml.v2"
 	"strings"
 
+	"gopkg.in/yaml.v2"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
diff --git a/pkg/stub/action/integration/initialize.go b/pkg/stub/action/integration/initialize.go
index c2e0289..aa4f5dc 100644
--- a/pkg/stub/action/integration/initialize.go
+++ b/pkg/stub/action/integration/initialize.go
@@ -53,7 +53,8 @@ func (action *initializeAction) Handle(integration *v1alpha1.Integration)
error
 	}
 
 	target := integration.DeepCopy()
-	// better not changing the spec section of the target because it may be used for comparison
by a higher level controller (e.g. Knative source controller)
+	// better not changing the spec section of the target because it may be used for comparison
by a
+	// higher level controller (e.g. Knative source controller)
 
 	// execute custom initialization
 	if _, err := trait.Apply(target, nil); err != nil {
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index 4157185..f5f02a3 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -295,7 +295,9 @@ func (t *knativeTrait) getConfigurationSerialized(e *Environment) (string,
error
 func (t *knativeTrait) getConfiguration(e *Environment) (knativeapi.CamelEnvironment, error)
{
 	env := knativeapi.NewCamelEnvironment()
 	if t.Configuration != "" {
-		env.Deserialize(t.Configuration)
+		if err := env.Deserialize(t.Configuration); err != nil {
+			return knativeapi.CamelEnvironment{}, err
+		}
 	}
 
 	// Sources
diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 3c73236..f9875a5 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -26,7 +26,7 @@ import (
 
 // GetIntegrationContext retrieves the context set on the integration
 func GetIntegrationContext(integration *v1alpha1.Integration) (*v1alpha1.IntegrationContext,
error) {
-	if integration.Status.Context== "" {
+	if integration.Status.Context == "" {
 		return nil, nil
 	}
 
diff --git a/pkg/util/source/inspector_xml.go b/pkg/util/source/inspector_xml.go
index c13f1e6..b2bd2e8 100644
--- a/pkg/util/source/inspector_xml.go
+++ b/pkg/util/source/inspector_xml.go
@@ -42,8 +42,7 @@ func (i XMLInspector) FromURIs(source v1alpha1.SourceSpec) ([]string, error)
{
 			break
 		}
 
-		switch se := t.(type) {
-		case xml.StartElement:
+		if se, ok := t.(xml.StartElement); ok {
 			switch se.Name.Local {
 			case "from", "fromF":
 				for _, a := range se.Attr {
@@ -72,8 +71,7 @@ func (i XMLInspector) ToURIs(source v1alpha1.SourceSpec) ([]string, error)
{
 			break
 		}
 
-		switch se := t.(type) {
-		case xml.StartElement:
+		if se, ok := t.(xml.StartElement); ok {
 			switch se.Name.Local {
 			case "to", "toD", "toF":
 				for _, a := range se.Attr {


Mime
View raw message