You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2019/01/07 14:25:46 UTC
[camel-k] 09/13: Fix #237: fix linter
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 f9d78ffaaa2cc35c19ee9265af02cb48749a1237
Author: nferraro <ni...@gmail.com>
AuthorDate: Fri Jan 4 17:29:19 2019 +0100
Fix #237: fix linter
---
.golangci.yml | 2 +-
cmd/manager/main.go | 4 +--
pkg/apis/camel/v1alpha1/common_types.go | 2 +-
pkg/apis/camel/v1alpha1/common_types_support.go | 1 +
.../camel/v1alpha1/integration_types_support.go | 5 +--
.../camel/v1alpha1/integrationplatform_types.go | 2 --
.../v1alpha1/integrationplatform_types_support.go | 5 +--
pkg/builder/builder.go | 3 +-
pkg/builder/builder_types.go | 10 +++---
pkg/builder/s2i/publisher.go | 2 +-
pkg/client/client.go | 15 ++++----
pkg/cmd/delete.go | 2 +-
pkg/cmd/install.go | 2 +-
pkg/cmd/log.go | 2 +-
pkg/cmd/reset.go | 5 ++-
pkg/cmd/root.go | 40 ++++++++++++----------
pkg/cmd/run.go | 11 +++---
pkg/cmd/util.go | 5 ++-
pkg/controller/integration/action.go | 1 +
pkg/controller/integration/deploy.go | 1 +
pkg/controller/integration/initialize.go | 1 +
.../integration/integration_controller.go | 2 +-
pkg/controller/integration/monitor.go | 1 +
pkg/controller/integration/util.go | 3 +-
pkg/controller/integrationcontext/action.go | 3 +-
pkg/controller/integrationcontext/initialize.go | 1 +
pkg/controller/integrationcontext/monitor.go | 1 +
pkg/controller/integrationplatform/action.go | 1 +
pkg/controller/integrationplatform/create.go | 1 +
pkg/controller/integrationplatform/initialize.go | 1 +
.../integrationplatform_controller.go | 3 +-
pkg/controller/integrationplatform/start.go | 1 +
pkg/install/cluster.go | 5 +--
pkg/install/common.go | 3 +-
pkg/platform/platform.go | 2 +-
pkg/trait/catalog.go | 5 ++-
pkg/trait/environment_test.go | 2 +-
pkg/trait/knative.go | 7 ++--
pkg/trait/knative_test.go | 2 +-
pkg/trait/trait.go | 3 +-
pkg/trait/trait_test.go | 2 +-
pkg/trait/types.go | 1 +
pkg/util/knative/knative.go | 1 +
pkg/util/kubernetes/customclient/customclient.go | 6 ++--
pkg/util/kubernetes/loader.go | 1 +
pkg/util/kubernetes/replace.go | 1 +
pkg/util/kubernetes/util.go | 2 +-
pkg/util/log/annotation_scraper.go | 2 +-
pkg/util/log/pod_scraper.go | 5 ++-
pkg/util/log/util.go | 2 +-
pkg/util/minishift/minishift.go | 4 +--
pkg/util/watch/watch.go | 1 +
52 files changed, 104 insertions(+), 92 deletions(-)
diff --git a/.golangci.yml b/.golangci.yml
index d4ece64..a67fb8d 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,6 +1,6 @@
linters-settings:
lll:
- line-length: 150
+ line-length: 170
linters:
enable-all: true
disable:
diff --git a/cmd/manager/main.go b/cmd/manager/main.go
index 41dd81f..19aed31 100644
--- a/cmd/manager/main.go
+++ b/cmd/manager/main.go
@@ -75,7 +75,7 @@ func main() {
}
// Become the leader before proceeding
- leader.Become(context.TODO(), "camel-k-lock")
+ leader.Become(context.TODO(), "camel-k-lock") // nolint: errcheck
r := ready.NewFileReady()
err = r.Set()
@@ -83,7 +83,7 @@ func main() {
log.Error(err, "")
os.Exit(1)
}
- defer r.Unset()
+ defer r.Unset() // nolint: errcheck
// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, manager.Options{Namespace: namespace})
diff --git a/pkg/apis/camel/v1alpha1/common_types.go b/pkg/apis/camel/v1alpha1/common_types.go
index 669239a..2d0aac7 100644
--- a/pkg/apis/camel/v1alpha1/common_types.go
+++ b/pkg/apis/camel/v1alpha1/common_types.go
@@ -42,4 +42,4 @@ type Flows []Flow
type Step struct {
Kind string `json:"kind"`
URI string `json:"uri"`
-}
\ No newline at end of file
+}
diff --git a/pkg/apis/camel/v1alpha1/common_types_support.go b/pkg/apis/camel/v1alpha1/common_types_support.go
index 0dd8844..84ff4f0 100644
--- a/pkg/apis/camel/v1alpha1/common_types_support.go
+++ b/pkg/apis/camel/v1alpha1/common_types_support.go
@@ -19,6 +19,7 @@ package v1alpha1
import (
"fmt"
+
"gopkg.in/yaml.v2"
)
diff --git a/pkg/apis/camel/v1alpha1/integration_types_support.go b/pkg/apis/camel/v1alpha1/integration_types_support.go
index 4400394..bdade9f 100644
--- a/pkg/apis/camel/v1alpha1/integration_types_support.go
+++ b/pkg/apis/camel/v1alpha1/integration_types_support.go
@@ -18,10 +18,11 @@ limitations under the License.
package v1alpha1
import (
+ "strings"
+
"github.com/apache/camel-k/pkg/util"
"github.com/mitchellh/mapstructure"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "strings"
)
// NewIntegrationList --
@@ -121,4 +122,4 @@ func (s SourceSpec) InferLanguage() Language {
}
}
return ""
-}
\ No newline at end of file
+}
diff --git a/pkg/apis/camel/v1alpha1/integrationplatform_types.go b/pkg/apis/camel/v1alpha1/integrationplatform_types.go
index 88fd5df..d13ea63 100644
--- a/pkg/apis/camel/v1alpha1/integrationplatform_types.go
+++ b/pkg/apis/camel/v1alpha1/integrationplatform_types.go
@@ -18,7 +18,6 @@ type IntegrationPlatformStatus struct {
Phase IntegrationPlatformPhase `json:"phase,omitempty"`
}
-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// IntegrationPlatform is the Schema for the integrationplatforms API
@@ -86,7 +85,6 @@ const (
IntegrationPlatformBuildPublishStrategyKaniko = "Kaniko"
)
-
// IntegrationPlatformPhase --
type IntegrationPlatformPhase string
diff --git a/pkg/apis/camel/v1alpha1/integrationplatform_types_support.go b/pkg/apis/camel/v1alpha1/integrationplatform_types_support.go
index 08f2ab3..11800d3 100644
--- a/pkg/apis/camel/v1alpha1/integrationplatform_types_support.go
+++ b/pkg/apis/camel/v1alpha1/integrationplatform_types_support.go
@@ -18,8 +18,9 @@ limitations under the License.
package v1alpha1
import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strings"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NewIntegrationPlatformList --
@@ -54,4 +55,4 @@ func TraitProfileByName(name string) TraitProfile {
}
}
return ""
-}
\ No newline at end of file
+}
diff --git a/pkg/builder/builder.go b/pkg/builder/builder.go
index 2760f11..9becccb 100644
--- a/pkg/builder/builder.go
+++ b/pkg/builder/builder.go
@@ -22,14 +22,13 @@ import (
"errors"
"io/ioutil"
"os"
- "github.com/apache/camel-k/pkg/client"
"sort"
"sync"
"sync/atomic"
"time"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
-
+ "github.com/apache/camel-k/pkg/client"
"github.com/sirupsen/logrus"
)
diff --git a/pkg/builder/builder_types.go b/pkg/builder/builder_types.go
index 662d068..6666bda 100644
--- a/pkg/builder/builder_types.go
+++ b/pkg/builder/builder_types.go
@@ -21,14 +21,12 @@ import (
"context"
"fmt"
"math"
- "github.com/apache/camel-k/pkg/client"
"time"
- "k8s.io/apimachinery/pkg/apis/meta/v1"
-
- "github.com/apache/camel-k/pkg/util/maven"
-
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "github.com/apache/camel-k/pkg/client"
+ "github.com/apache/camel-k/pkg/util/maven"
+ "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
@@ -137,7 +135,7 @@ type Result struct {
// Context --
type Context struct {
- C context.Context
+ C context.Context
client.Client
Request Request
Image string
diff --git a/pkg/builder/s2i/publisher.go b/pkg/builder/s2i/publisher.go
index 757d1b3..b02a7ef 100644
--- a/pkg/builder/s2i/publisher.go
+++ b/pkg/builder/s2i/publisher.go
@@ -135,7 +135,7 @@ func Publisher(ctx *builder.Context) error {
}
ocbuild := buildv1.Build{}
- json.Unmarshal(data, &ocbuild)
+ err = json.Unmarshal(data, &ocbuild)
if err != nil {
return errors.Wrap(err, "cannot unmarshal instantiated binary response")
}
diff --git a/pkg/client/client.go b/pkg/client/client.go
index 756ac28..7a0c73a 100644
--- a/pkg/client/client.go
+++ b/pkg/client/client.go
@@ -18,19 +18,20 @@ limitations under the License.
package client
import (
+ "io/ioutil"
+ "os"
+ "os/user"
+ "path/filepath"
+
"github.com/apache/camel-k/pkg/apis"
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
"github.com/pkg/errors"
- "io/ioutil"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest"
- "os"
- "os/user"
- "path/filepath"
controller "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"
@@ -73,6 +74,9 @@ func NewOutOfClusterClient(kubeconfig string) (Client, error) {
// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, options)
+ if err != nil {
+ return nil, err
+ }
// Setup Scheme for all resources
if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
@@ -116,12 +120,11 @@ func FromManager(manager manager.Manager) (Client, error) {
}
// init initialize the k8s client for usage outside the cluster
-func initialize(kubeconfig string) error {
+func initialize(kubeconfig string) {
if kubeconfig == "" {
kubeconfig = getDefaultKubeConfigFile()
}
os.Setenv(k8sutil.KubeConfigEnvVar, kubeconfig)
- return nil
}
func getDefaultKubeConfigFile() string {
diff --git a/pkg/cmd/delete.go b/pkg/cmd/delete.go
index 22a9280..15378d7 100644
--- a/pkg/cmd/delete.go
+++ b/pkg/cmd/delete.go
@@ -22,11 +22,11 @@ import (
"fmt"
"strconv"
- k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/spf13/cobra"
k8errors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)
// newCmdDelete --
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index fceebdf..c097cb6 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -19,13 +19,13 @@ package cmd
import (
"fmt"
+ "strings"
"github.com/apache/camel-k/pkg/install"
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/pkg/errors"
"github.com/spf13/cobra"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
- "strings"
)
func newCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command {
diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go
index 8e92ebc..b847c49 100644
--- a/pkg/cmd/log.go
+++ b/pkg/cmd/log.go
@@ -19,11 +19,11 @@ package cmd
import (
"fmt"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/util/log"
"github.com/spf13/cobra"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)
diff --git a/pkg/cmd/reset.go b/pkg/cmd/reset.go
index 652964f..6946f7e 100644
--- a/pkg/cmd/reset.go
+++ b/pkg/cmd/reset.go
@@ -19,13 +19,12 @@ package cmd
import (
"fmt"
- "github.com/apache/camel-k/pkg/client"
-
- k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "github.com/apache/camel-k/pkg/client"
"github.com/pkg/errors"
"github.com/spf13/cobra"
+ k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)
func newCmdReset(rootCmdOptions *RootCmdOptions) *cobra.Command {
diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go
index 584489e..c718d94 100644
--- a/pkg/cmd/root.go
+++ b/pkg/cmd/root.go
@@ -19,15 +19,15 @@ package cmd
import (
"context"
+
"github.com/apache/camel-k/pkg/client"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
-const kamelCommandLongDescription = `
-Long: "Apache Camel K (a.k.a. Kamel) is a lightweight integration framework
+const kamelCommandLongDescription = `Apache Camel K is a lightweight integration framework
built from Apache Camel that runs natively on Kubernetes and is
-specifically designed for serverless and microservice architectures.",,
+specifically designed for serverless and microservice architectures.
`
// RootCmdOptions --
@@ -44,23 +44,11 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command, error) {
Context: ctx,
}
var cmd = cobra.Command{
- Use: "kamel",
- Short: "Kamel is a awesome client tool for running Apache Camel integrations natively on Kubernetes",
- Long: kamelCommandLongDescription,
BashCompletionFunction: bashCompletionFunction,
- PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
- if options.Namespace == "" {
- current, err := client.GetCurrentNamespace(options.KubeConfig)
- if err != nil {
- return errors.Wrap(err, "cannot get current namespace")
- }
- err = cmd.Flag("namespace").Value.Set(current)
- if err != nil {
- return err
- }
- }
- return nil
- },
+ PersistentPreRunE: options.preRun,
+ Use: "kamel",
+ Short: "Kamel is a awesome client tool for running Apache Camel integrations natively on Kubernetes",
+ Long: kamelCommandLongDescription,
}
cmd.PersistentFlags().StringVar(&options.KubeConfig, "config", "", "Path to the config file to use for CLI requests")
@@ -79,6 +67,20 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command, error) {
return &cmd, nil
}
+func (command *RootCmdOptions) preRun(cmd *cobra.Command, args []string) error {
+ if command.Namespace == "" {
+ current, err := client.GetCurrentNamespace(command.KubeConfig)
+ if err != nil {
+ return errors.Wrap(err, "cannot get current namespace")
+ }
+ err = cmd.Flag("namespace").Value.Set(current)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// GetCmdClient returns a client that can be used from command line tools
func (command *RootCmdOptions) GetCmdClient() (client.Client, error) {
// Get the pre-computed client
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 26def41..f7addb2 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -21,7 +21,6 @@ import (
"bytes"
"encoding/base64"
"fmt"
- "github.com/apache/camel-k/pkg/client"
"io/ioutil"
"net/http"
"os"
@@ -32,19 +31,17 @@ import (
"strings"
"syscall"
+ "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/gzip"
-
"github.com/apache/camel-k/pkg/trait"
"github.com/apache/camel-k/pkg/util"
-
- "github.com/pkg/errors"
- "github.com/sirupsen/logrus"
-
- "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/apache/camel-k/pkg/util/log"
"github.com/apache/camel-k/pkg/util/sync"
"github.com/apache/camel-k/pkg/util/watch"
+ "github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1"
diff --git a/pkg/cmd/util.go b/pkg/cmd/util.go
index 70dd208..d6cb4ee 100644
--- a/pkg/cmd/util.go
+++ b/pkg/cmd/util.go
@@ -19,9 +19,10 @@ package cmd
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/apache/camel-k/pkg/client"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// DeleteIntegration --
@@ -38,5 +39,3 @@ func DeleteIntegration(ctx context.Context, c client.Client, name string, namesp
}
return c.Delete(ctx, &integration)
}
-
-
diff --git a/pkg/controller/integration/action.go b/pkg/controller/integration/action.go
index 6a66e06..eebadef 100644
--- a/pkg/controller/integration/action.go
+++ b/pkg/controller/integration/action.go
@@ -19,6 +19,7 @@ package integration
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/client"
)
diff --git a/pkg/controller/integration/deploy.go b/pkg/controller/integration/deploy.go
index 1ea1096..a8ac087 100644
--- a/pkg/controller/integration/deploy.go
+++ b/pkg/controller/integration/deploy.go
@@ -19,6 +19,7 @@ package integration
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/trait"
"github.com/apache/camel-k/pkg/util/kubernetes"
diff --git a/pkg/controller/integration/initialize.go b/pkg/controller/integration/initialize.go
index d99c8c5..aa824af 100644
--- a/pkg/controller/integration/initialize.go
+++ b/pkg/controller/integration/initialize.go
@@ -19,6 +19,7 @@ package integration
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/trait"
diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index ddbe9a7..eb8e33a 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -2,11 +2,11 @@ package integration
import (
"context"
- "github.com/sirupsen/logrus"
"time"
camelv1alpha1 "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/client"
+ "github.com/sirupsen/logrus"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
diff --git a/pkg/controller/integration/monitor.go b/pkg/controller/integration/monitor.go
index e45cb1b..3f0d6a5 100644
--- a/pkg/controller/integration/monitor.go
+++ b/pkg/controller/integration/monitor.go
@@ -19,6 +19,7 @@ package integration
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/util/digest"
"github.com/sirupsen/logrus"
diff --git a/pkg/controller/integration/util.go b/pkg/controller/integration/util.go
index 2581cdc..9c31ec8 100644
--- a/pkg/controller/integration/util.go
+++ b/pkg/controller/integration/util.go
@@ -20,7 +20,6 @@ package integration
import (
"context"
- "github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/util"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
@@ -29,7 +28,7 @@ import (
)
// LookupContextForIntegration --
-func LookupContextForIntegration(ctx context.Context, c client.Client, integration *v1alpha1.Integration) (*v1alpha1.IntegrationContext, error) {
+func LookupContextForIntegration(ctx context.Context, c k8sclient.Reader, integration *v1alpha1.Integration) (*v1alpha1.IntegrationContext, error) {
if integration.Status.Context != "" {
name := integration.Status.Context
ictx := v1alpha1.NewIntegrationContext(integration.Namespace, name)
diff --git a/pkg/controller/integrationcontext/action.go b/pkg/controller/integrationcontext/action.go
index 55e72c8..6d1369a 100644
--- a/pkg/controller/integrationcontext/action.go
+++ b/pkg/controller/integrationcontext/action.go
@@ -19,6 +19,7 @@ package integrationcontext
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/client"
)
@@ -43,4 +44,4 @@ type baseAction struct {
func (action *baseAction) InjectClient(client client.Client) {
action.client = client
-}
\ No newline at end of file
+}
diff --git a/pkg/controller/integrationcontext/initialize.go b/pkg/controller/integrationcontext/initialize.go
index 0cb363c..20302ac 100644
--- a/pkg/controller/integrationcontext/initialize.go
+++ b/pkg/controller/integrationcontext/initialize.go
@@ -19,6 +19,7 @@ package integrationcontext
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util/digest"
diff --git a/pkg/controller/integrationcontext/monitor.go b/pkg/controller/integrationcontext/monitor.go
index 3570e33..5265bca 100644
--- a/pkg/controller/integrationcontext/monitor.go
+++ b/pkg/controller/integrationcontext/monitor.go
@@ -19,6 +19,7 @@ package integrationcontext
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/util/digest"
"github.com/sirupsen/logrus"
diff --git a/pkg/controller/integrationplatform/action.go b/pkg/controller/integrationplatform/action.go
index b332a74..fccc36c 100644
--- a/pkg/controller/integrationplatform/action.go
+++ b/pkg/controller/integrationplatform/action.go
@@ -19,6 +19,7 @@ package integrationplatform
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/client"
)
diff --git a/pkg/controller/integrationplatform/create.go b/pkg/controller/integrationplatform/create.go
index 36c8c7b..82cfcd3 100644
--- a/pkg/controller/integrationplatform/create.go
+++ b/pkg/controller/integrationplatform/create.go
@@ -19,6 +19,7 @@ package integrationplatform
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/install"
"github.com/sirupsen/logrus"
diff --git a/pkg/controller/integrationplatform/initialize.go b/pkg/controller/integrationplatform/initialize.go
index 79fff73..a508a2c 100644
--- a/pkg/controller/integrationplatform/initialize.go
+++ b/pkg/controller/integrationplatform/initialize.go
@@ -20,6 +20,7 @@ package integrationplatform
import (
"context"
"errors"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
platformutils "github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util/openshift"
diff --git a/pkg/controller/integrationplatform/integrationplatform_controller.go b/pkg/controller/integrationplatform/integrationplatform_controller.go
index 2a943d4..0859f95 100644
--- a/pkg/controller/integrationplatform/integrationplatform_controller.go
+++ b/pkg/controller/integrationplatform/integrationplatform_controller.go
@@ -2,6 +2,8 @@ package integrationplatform
import (
"context"
+ "time"
+
camelv1alpha1 "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/client"
"github.com/sirupsen/logrus"
@@ -13,7 +15,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/source"
- "time"
)
var log = logf.Log.WithName("controller_integrationplatform")
diff --git a/pkg/controller/integrationplatform/start.go b/pkg/controller/integrationplatform/start.go
index 536c9d0..6d69bf6 100644
--- a/pkg/controller/integrationplatform/start.go
+++ b/pkg/controller/integrationplatform/start.go
@@ -19,6 +19,7 @@ package integrationplatform
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/labels"
diff --git a/pkg/install/cluster.go b/pkg/install/cluster.go
index 4c78f5c..7adf008 100644
--- a/pkg/install/cluster.go
+++ b/pkg/install/cluster.go
@@ -19,6 +19,7 @@ package install
import (
"context"
+
"github.com/apache/camel-k/deploy"
"github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/util/kubernetes"
@@ -31,7 +32,7 @@ import (
)
// SetupClusterwideResources --
-func SetupClusterwideResources(ctx context.Context, c client.Client, ) error {
+func SetupClusterwideResources(ctx context.Context, c client.Client) error {
return SetupClusterwideResourcesOrCollect(ctx, c, nil)
}
@@ -127,7 +128,7 @@ func installCRD(ctx context.Context, c client.Client, kind string, resourceName
}
// IsClusterRoleInstalled check if cluster role camel-k:edit is installed
-func IsClusterRoleInstalled(ctx context.Context, c client.Client, ) (bool, error) {
+func IsClusterRoleInstalled(ctx context.Context, c client.Client) (bool, error) {
clusterRole := v1.ClusterRole{
TypeMeta: metav1.TypeMeta{
Kind: "ClusterRole",
diff --git a/pkg/install/common.go b/pkg/install/common.go
index fe18638..a2edac4 100644
--- a/pkg/install/common.go
+++ b/pkg/install/common.go
@@ -19,13 +19,14 @@ package install
import (
"context"
+
"github.com/apache/camel-k/deploy"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/util/kubernetes"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
- "github.com/apache/camel-k/pkg/client"
)
// Resources installs named resources from the project resource directory
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index df8fab6..48cffcb 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -20,10 +20,10 @@ package platform
import (
"context"
"errors"
- "github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/builder"
+ "github.com/apache/camel-k/pkg/client"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)
diff --git a/pkg/trait/catalog.go b/pkg/trait/catalog.go
index facab15..47decb0 100644
--- a/pkg/trait/catalog.go
+++ b/pkg/trait/catalog.go
@@ -20,13 +20,12 @@ package trait
import (
"context"
"reflect"
- "github.com/apache/camel-k/pkg/client"
"strings"
- "github.com/sirupsen/logrus"
-
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "github.com/apache/camel-k/pkg/client"
"github.com/fatih/structs"
+ "github.com/sirupsen/logrus"
)
// Catalog collects all information about traits in one place
diff --git a/pkg/trait/environment_test.go b/pkg/trait/environment_test.go
index 955eca3..0fd35f1 100644
--- a/pkg/trait/environment_test.go
+++ b/pkg/trait/environment_test.go
@@ -191,4 +191,4 @@ func TestDisabledContainerMetaDataEnvVars(t *testing.T) {
func NewEnvironmentTestCatalog() *Catalog {
return NewCatalog(context.TODO(), nil)
-}
\ No newline at end of file
+}
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index ac33930..cc6e990 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -19,20 +19,17 @@ package trait
import (
"fmt"
- "github.com/apache/camel-k/pkg/util/envvar"
-
"strconv"
"strings"
- "github.com/pkg/errors"
-
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
-
knativeapi "github.com/apache/camel-k/pkg/apis/camel/v1alpha1/knative"
"github.com/apache/camel-k/pkg/metadata"
+ "github.com/apache/camel-k/pkg/util/envvar"
knativeutil "github.com/apache/camel-k/pkg/util/knative"
eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
+ "github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go
index cb1818d..73406e2 100644
--- a/pkg/trait/knative_test.go
+++ b/pkg/trait/knative_test.go
@@ -135,4 +135,4 @@ func TestKnativeTraitWithCompressedSources(t *testing.T) {
func NewKnativeTestCatalog() *Catalog {
return NewCatalog(context.TODO(), nil)
-}
\ No newline at end of file
+}
diff --git a/pkg/trait/trait.go b/pkg/trait/trait.go
index df773e4..8c28086 100644
--- a/pkg/trait/trait.go
+++ b/pkg/trait/trait.go
@@ -19,12 +19,13 @@ package trait
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/pkg/errors"
"k8s.io/api/core/v1"
- "github.com/apache/camel-k/pkg/client"
)
// True --
diff --git a/pkg/trait/trait_test.go b/pkg/trait/trait_test.go
index bb206d3..3ea9b7d 100644
--- a/pkg/trait/trait_test.go
+++ b/pkg/trait/trait_test.go
@@ -203,4 +203,4 @@ func createTestEnv(cluster v1alpha1.IntegrationPlatformCluster, script string) *
func NewTraitTestCatalog() *Catalog {
return NewCatalog(context.TODO(), nil)
-}
\ No newline at end of file
+}
diff --git a/pkg/trait/types.go b/pkg/trait/types.go
index 8b48645..b9d892d 100644
--- a/pkg/trait/types.go
+++ b/pkg/trait/types.go
@@ -19,6 +19,7 @@ package trait
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/builder"
"github.com/apache/camel-k/pkg/client"
diff --git a/pkg/util/knative/knative.go b/pkg/util/knative/knative.go
index 19cd091..7f86ba9 100644
--- a/pkg/util/knative/knative.go
+++ b/pkg/util/knative/knative.go
@@ -19,6 +19,7 @@ package knative
import (
"context"
+
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/kubernetes"
)
diff --git a/pkg/util/kubernetes/customclient/customclient.go b/pkg/util/kubernetes/customclient/customclient.go
index 866d508..345be1d 100644
--- a/pkg/util/kubernetes/customclient/customclient.go
+++ b/pkg/util/kubernetes/customclient/customclient.go
@@ -60,8 +60,8 @@ func GetDynamicClientFor(group string, version string, kind string, namespace st
return nil, err
}
return dynamicClient.Resource(schema.GroupVersionResource{
- Group: group,
- Version: version,
+ Group: group,
+ Version: version,
Resource: kind,
}).Namespace(namespace), nil
-}
\ No newline at end of file
+}
diff --git a/pkg/util/kubernetes/loader.go b/pkg/util/kubernetes/loader.go
index fb6b909..aba9700 100644
--- a/pkg/util/kubernetes/loader.go
+++ b/pkg/util/kubernetes/loader.go
@@ -20,6 +20,7 @@ package kubernetes
import (
"encoding/json"
"fmt"
+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
diff --git a/pkg/util/kubernetes/replace.go b/pkg/util/kubernetes/replace.go
index 619eb9e..ba7b347 100644
--- a/pkg/util/kubernetes/replace.go
+++ b/pkg/util/kubernetes/replace.go
@@ -19,6 +19,7 @@ package kubernetes
import (
"context"
+
"github.com/apache/camel-k/pkg/client"
eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
routev1 "github.com/openshift/api/route/v1"
diff --git a/pkg/util/kubernetes/util.go b/pkg/util/kubernetes/util.go
index d07940c..6da33ad 100644
--- a/pkg/util/kubernetes/util.go
+++ b/pkg/util/kubernetes/util.go
@@ -19,10 +19,10 @@ package kubernetes
import (
"fmt"
- "k8s.io/apimachinery/pkg/util/json"
"gopkg.in/yaml.v2"
"k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/util/json"
)
// ToJSON --
diff --git a/pkg/util/log/annotation_scraper.go b/pkg/util/log/annotation_scraper.go
index 52be8dc..31aaba7 100644
--- a/pkg/util/log/annotation_scraper.go
+++ b/pkg/util/log/annotation_scraper.go
@@ -21,7 +21,6 @@ import (
"bufio"
"context"
"io"
- "k8s.io/client-go/kubernetes"
"strconv"
"sync"
"sync/atomic"
@@ -30,6 +29,7 @@ import (
"github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/client-go/kubernetes"
)
// SelectorScraper scrapes all pods with a given selector
diff --git a/pkg/util/log/pod_scraper.go b/pkg/util/log/pod_scraper.go
index 6d74eb6..a0c3c16 100644
--- a/pkg/util/log/pod_scraper.go
+++ b/pkg/util/log/pod_scraper.go
@@ -21,8 +21,6 @@ import (
"bufio"
"context"
"io"
- "k8s.io/apimachinery/pkg/util/json"
- "k8s.io/client-go/kubernetes"
"time"
"github.com/pkg/errors"
@@ -31,7 +29,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/watch"
+ "k8s.io/client-go/kubernetes"
)
var commonUserContainerNames = map[string]bool{
@@ -176,7 +176,6 @@ func (s *PodScraper) waitForPodRunning(ctx context.Context, namespace string, na
return "", err
}
-
} else if gotPod, ok := e.Object.(*v1.Pod); ok {
recvPod = gotPod
}
diff --git a/pkg/util/log/util.go b/pkg/util/log/util.go
index d4c4254..eb20eb9 100644
--- a/pkg/util/log/util.go
+++ b/pkg/util/log/util.go
@@ -22,10 +22,10 @@ import (
"fmt"
"io"
"io/ioutil"
- "k8s.io/client-go/kubernetes"
"os"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+ "k8s.io/client-go/kubernetes"
)
// Print prints integrations logs to the stdout
diff --git a/pkg/util/minishift/minishift.go b/pkg/util/minishift/minishift.go
index ae6ebdc..1a106e2 100644
--- a/pkg/util/minishift/minishift.go
+++ b/pkg/util/minishift/minishift.go
@@ -20,12 +20,12 @@ package minishift
import (
"context"
- "github.com/apache/camel-k/pkg/client"
- "k8s.io/apimachinery/pkg/labels"
"strconv"
+ "github.com/apache/camel-k/pkg/client"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/labels"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)
diff --git a/pkg/util/watch/watch.go b/pkg/util/watch/watch.go
index b9e56b4..dcf35ae 100644
--- a/pkg/util/watch/watch.go
+++ b/pkg/util/watch/watch.go
@@ -19,6 +19,7 @@ package watch
import (
"context"
+
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/util/kubernetes/customclient"
"github.com/sirupsen/logrus"