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/09/18 18:47:59 UTC

[camel-k] 03/04: Fix #792: fix findings

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 4fa3d1aab4326c5373641da17a8034f2bf9be67a
Author: nferraro <ni...@gmail.com>
AuthorDate: Wed Sep 18 13:49:42 2019 +0200

    Fix #792: fix findings
---
 pkg/client/client.go     | 2 +-
 pkg/client/fastmapper.go | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkg/client/client.go b/pkg/client/client.go
index ddb8332..eebbd28 100644
--- a/pkg/client/client.go
+++ b/pkg/client/client.go
@@ -23,10 +23,10 @@ import (
 	"os/user"
 	"path/filepath"
 
-	"k8s.io/apimachinery/pkg/api/meta"
 	"github.com/apache/camel-k/pkg/apis"
 	"github.com/operator-framework/operator-sdk/pkg/k8sutil"
 	"github.com/pkg/errors"
+	"k8s.io/apimachinery/pkg/api/meta"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/apimachinery/pkg/runtime/schema"
 	"k8s.io/client-go/kubernetes"
diff --git a/pkg/client/fastmapper.go b/pkg/client/fastmapper.go
index 2ce44bf..71eaa65 100644
--- a/pkg/client/fastmapper.go
+++ b/pkg/client/fastmapper.go
@@ -40,9 +40,10 @@ func newFastDiscoveryRESTMapperWithFilter(config *rest.Config, filter func(*meta
 	wg := wait.Group{}
 	totalCount := 0
 	pickedCount := 0
-	var grs []*restmapper.APIGroupResources
+	grs := make([]*restmapper.APIGroupResources, 0)
 	for _, group := range groups.Groups {
-		pick := filter(&group)
+		pinnedGroup := group
+		pick := filter(&pinnedGroup)
 		logrus.Debugf("Group: %s %v", group.Name, pick)
 		totalCount++
 		if !pick {