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 3e6bd50caf27138567fbcbe415ae7634d46d48f6
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Thu Jun 27 12:00:36 2019 +0200

    chore(lint): fix findings
---
 .golangci.yml                            |  2 --
 pkg/cmd/run.go                           |  6 +++++-
 pkg/controller/integration/initialize.go |  2 +-
 pkg/util/kubernetes/log/pod_scraper.go   | 13 ++++++-------
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/.golangci.yml b/.golangci.yml
index 3be44c8..a67fb8d 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,5 +1,3 @@
-run:
-  modules-download-mode: vendor
 linters-settings:
   lll:
     line-length: 170
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 374aba5..dee78b0 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -138,8 +138,12 @@ func (o *runCmdOptions) validateArgs(_ *cobra.Command, 
args []string) error {
                                return errors.Wrap(err, "error while accessing 
file "+fileName)
                        }
                } else {
-                       /* #nosec */
+                       // nolint: gosec
                        resp, err := http.Get(fileName)
+                       if resp != nil && resp.Body != nil {
+                               resp.Body.Close()
+                       }
+
                        if err != nil {
                                return errors.Wrap(err, "The URL provided is 
not reachable")
                        } else if resp.StatusCode != 200 {
diff --git a/pkg/controller/integration/initialize.go 
b/pkg/controller/integration/initialize.go
index 3e5f921..b8cbac7 100644
--- a/pkg/controller/integration/initialize.go
+++ b/pkg/controller/integration/initialize.go
@@ -55,7 +55,7 @@ func (action *initializeAction) Handle(ctx context.Context, 
integration *v1alpha
        }
 
        // The integration platform needs to be ready before starting to create 
integrations
-       if err != nil || pl.Status.Phase != 
v1alpha1.IntegrationPlatformPhaseReady {
+       if pl.Status.Phase != v1alpha1.IntegrationPlatformPhaseReady {
                action.L.Info("Waiting for the integration platform to be 
initialized")
 
                if integration.Status.Phase != 
v1alpha1.IntegrationPhaseWaitingForPlatform {
diff --git a/pkg/util/kubernetes/log/pod_scraper.go 
b/pkg/util/kubernetes/log/pod_scraper.go
index 094e5bc..162e26c 100644
--- a/pkg/util/kubernetes/log/pod_scraper.go
+++ b/pkg/util/kubernetes/log/pod_scraper.go
@@ -89,21 +89,20 @@ func (s *PodScraper) doScrape(ctx context.Context, out 
*bufio.Writer, clientClos
        }
 
        reader := bufio.NewReader(byteReader)
-       err = nil
-       for err == nil {
-               str, err := reader.ReadString('\n')
+       for {
+               data, err := reader.ReadBytes('\n')
+               if err == io.EOF {
+                       return
+               }
                if err != nil {
                        break
                }
-               _, err = out.WriteString(str)
+               _, err = out.Write(data)
                if err != nil {
                        break
                }
                out.Flush()
        }
-       if err == io.EOF {
-               return
-       }
 
        s.handleAndRestart(ctx, err, 5*time.Second, out, clientCloser)
 }

Reply via email to