From b21fe0a9df9c0fc2d481753054f6791bc6a979a2 Mon Sep 17 00:00:00 2001 From: dntosas Date: Wed, 11 Oct 2023 20:45:55 +0300 Subject: [PATCH] fix: linter errors for take-along-labels Signed-off-by: dntosas --- Makefile | 8 ++++---- charts/capi2argo-cluster-operator/Chart.yaml | 4 ++-- .../templates/clusterrole.yaml | 1 - charts/capi2argo-cluster-operator/values.yaml | 2 +- controllers/argo_cluster.go | 13 ++++++------- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 6e9117cd..fe6436b1 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,13 @@ USER = $(shell id -u) GROUP = $(shell id -g) PROJECT = "capi2argo-cluster-operator" GOBUILD_OPTS = -ldflags="-s -w -X ${PROJECT}/cmd.Version=${VERSION} -X ${PROJECT}/cmd.CommitHash=${COMMIT}" -GO_IMAGE = "golang:1.20-alpine" -GO_IMAGE_CI = "golangci/golangci-lint:v1.52.2" +GO_IMAGE = "golang:1.21-alpine" +GO_IMAGE_CI = "golangci/golangci-lint:v1.54.2" DISTROLESS_IMAGE = "gcr.io/distroless/static:nonroot" IMAGE_TAG_BASE ?= "ghcr.io/dntosas/${PROJECT}" # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.26.1 +ENVTEST_K8S_VERSION = 1.27.1 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -39,7 +39,7 @@ vet: ## Run go vet against code. .PHONY: lint lint: ## Run golangci-lint against code. - @docker run --rm --volume "${PWD}:/app" -w /app "${GO_IMAGE_CI}" golangci-lint run --enable revive,gofmt,exportloopref --exclude-use-default=false --modules-download-mode=vendor --build-tags integration + golangci-lint run --enable revive,gofmt,exportloopref --exclude-use-default=false --modules-download-mode=vendor --build-tags integration .PHONY: test test: envtest ## Run go tests against code. diff --git a/charts/capi2argo-cluster-operator/Chart.yaml b/charts/capi2argo-cluster-operator/Chart.yaml index 331c16f1..91b678ef 100644 --- a/charts/capi2argo-cluster-operator/Chart.yaml +++ b/charts/capi2argo-cluster-operator/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 0.1.13 +appVersion: 0.1.14 description: Capi-2-Argo Cluster Operator (CACO) converts ClusterAPI Cluster credentials into ArgoCD Cluster definitions and keep them synchronized. home: https://github.com/dntosas/capi2argo-cluster-operator keywords: @@ -11,7 +11,7 @@ maintainers: name: capi2argo-cluster-operator sources: - https://github.com/dntosas/capi2argo-cluster-operator -version: 0.1.13 +version: 0.1.14 dependencies: - name: common repository: "https://charts.bitnami.com/bitnami" diff --git a/charts/capi2argo-cluster-operator/templates/clusterrole.yaml b/charts/capi2argo-cluster-operator/templates/clusterrole.yaml index 474a1055..96866e7f 100644 --- a/charts/capi2argo-cluster-operator/templates/clusterrole.yaml +++ b/charts/capi2argo-cluster-operator/templates/clusterrole.yaml @@ -28,5 +28,4 @@ rules: - get - list - watch - {{- end }} diff --git a/charts/capi2argo-cluster-operator/values.yaml b/charts/capi2argo-cluster-operator/values.yaml index e01dd518..585834a2 100644 --- a/charts/capi2argo-cluster-operator/values.yaml +++ b/charts/capi2argo-cluster-operator/values.yaml @@ -12,7 +12,7 @@ replicaCount: 1 image: registry: ghcr.io repository: dntosas/capi2argo-cluster-operator - tag: v0.1.13 + tag: v0.1.14 pullPolicy: Always pullSecrets: [] diff --git a/controllers/argo_cluster.go b/controllers/argo_cluster.go index 06fb8aed..459a6585 100644 --- a/controllers/argo_cluster.go +++ b/controllers/argo_cluster.go @@ -19,7 +19,8 @@ import ( var ( // ArgoNamespace represents the Namespace that hold ArgoCluster secrets. - ArgoNamespace string + ArgoNamespace string + // TestKubeConfig represents TestKubeConfig *rest.Config ) @@ -63,13 +64,11 @@ func NewArgoCluster(c *CapiCluster, s *corev1.Secret, cluster *clusterv1.Cluster log := ctrl.Log.WithName("argoCluster") takeAlongLabels := map[string]string{} - errors := []string{} + var errList []string if cluster != nil { - takeAlongLabels, errors = buildTakeAlongLabels(cluster) - if errors != nil { - for _, e := range errors { - log.Info(e) - } + takeAlongLabels, errList = buildTakeAlongLabels(cluster) + for _, e := range errList { + log.Info(e) } } return &ArgoCluster{