From 4588c9f60485db798e906125ae848482d228a726 Mon Sep 17 00:00:00 2001 From: Zsolt Varga Date: Fri, 26 Jan 2024 13:55:15 +0100 Subject: [PATCH] bump golangci version --- .golangci.yml | 12 ++++++++++++ Makefile | 4 ++-- controllers/istiocontrolplane_controller.go | 6 +++--- internal/components/cni/cni_test.go | 2 +- internal/components/discovery/discovery_test.go | 2 +- .../istiomeshgateway/istiomeshgateway_test.go | 2 +- .../components/meshexpansion/meshexpansion_test.go | 2 +- .../resourcesyncrule/resourcesyncrule_test.go | 2 +- .../sidecarinjector/sidecarinjector_test.go | 2 +- internal/util/openshift/predicate.go | 2 +- internal/util/template.go | 4 ++-- 11 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 745ab272d..9ea91dde5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -32,6 +32,13 @@ linters: # - nestif # - testpackage + - mirror + - revive + - contextcheck + - depguard + - exhaustruct + - nonamedreturns + # special cases only - exhaustivestruct @@ -39,6 +46,11 @@ linters: - maligned - interfacer - scopelint + - varcheck + - structcheck + - nosnakecase + - deadcode + - ifshort linters-settings: gomnd: diff --git a/Makefile b/Makefile index 568f0e0b0..9713e4a96 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ API_REL_TAG ?= api/${REL_TAG} EMBEDDED_CHART_REL_TAG ?= deploy/charts/v${CHART_VERSION} HELM_CHART_REL_TAG ?= chart/istio-operator/${CHART_VERSION} -GOLANGCI_VERSION = 1.45.2 -LICENSEI_VERSION = 0.7.0 +GOLANGCI_VERSION = 1.54.2 +LICENSEI_VERSION = 0.9.0 ENVTEST_K8S_VERSION = 1.26.0 KUSTOMIZE_VERSION = 4.1.2 ISTIO_VERSION = 1.17.1 diff --git a/controllers/istiocontrolplane_controller.go b/controllers/istiocontrolplane_controller.go index 6edf21766..24a99d72c 100644 --- a/controllers/istiocontrolplane_controller.go +++ b/controllers/istiocontrolplane_controller.go @@ -79,7 +79,7 @@ const ( istioControlPlaneFinalizerID = "istio-controlplane.servicemesh.cisco.com" meshExpansionGatewayRemovalRequeueDuration = time.Second * 30 readerServiceAccountName = "istio-reader" - // nolint:gosec + //nolint:gosec readerSecretType = "k8s.cisco.com/istio-reader-secret" ) @@ -850,7 +850,7 @@ func (r *IstioControlPlaneReconciler) getMeshNetworks(ctx context.Context, icp * Gw: &v1alpha1.Network_IstioNetworkGateway_Address{ Address: address, }, - Port: 15443, // nolint:gomnd + Port: 15443, //nolint:gomnd }) } @@ -1272,7 +1272,7 @@ func (r *IstioControlPlaneReconciler) getNamespaceInjectionSourcePICP(ctx contex var sourceICP *servicemeshv1alpha1.PeerIstioControlPlane for _, picp := range picpList.Items { picp := picp - if v, ok := picp.GetAnnotations()[servicemeshv1alpha1.NamespaceInjectionSourceAnnotation]; ok && v == "true" && picp.GetStatus().IstioControlPlaneName == cp.Name { // nolint:goconst + if v, ok := picp.GetAnnotations()[servicemeshv1alpha1.NamespaceInjectionSourceAnnotation]; ok && v == "true" && picp.GetStatus().IstioControlPlaneName == cp.Name { //nolint:goconst sourceICP = &picp } } diff --git a/internal/components/cni/cni_test.go b/internal/components/cni/cni_test.go index 9c8ee3bbe..d32334684 100644 --- a/internal/components/cni/cni_test.go +++ b/internal/components/cni/cni_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/internal/components/discovery/discovery_test.go b/internal/components/discovery/discovery_test.go index 16df4e7c6..1764cfdfe 100644 --- a/internal/components/discovery/discovery_test.go +++ b/internal/components/discovery/discovery_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/internal/components/istiomeshgateway/istiomeshgateway_test.go b/internal/components/istiomeshgateway/istiomeshgateway_test.go index 2e026a9ed..96163aadc 100644 --- a/internal/components/istiomeshgateway/istiomeshgateway_test.go +++ b/internal/components/istiomeshgateway/istiomeshgateway_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/internal/components/meshexpansion/meshexpansion_test.go b/internal/components/meshexpansion/meshexpansion_test.go index 9cdd4ba3b..248a6c5c3 100644 --- a/internal/components/meshexpansion/meshexpansion_test.go +++ b/internal/components/meshexpansion/meshexpansion_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/internal/components/resourcesyncrule/resourcesyncrule_test.go b/internal/components/resourcesyncrule/resourcesyncrule_test.go index a3ed59cc0..5e41eeb04 100644 --- a/internal/components/resourcesyncrule/resourcesyncrule_test.go +++ b/internal/components/resourcesyncrule/resourcesyncrule_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/internal/components/sidecarinjector/sidecarinjector_test.go b/internal/components/sidecarinjector/sidecarinjector_test.go index e83c86c8a..cb4eb8dfa 100644 --- a/internal/components/sidecarinjector/sidecarinjector_test.go +++ b/internal/components/sidecarinjector/sidecarinjector_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/internal/util/openshift/predicate.go b/internal/util/openshift/predicate.go index 3f2e338e5..8cba712a8 100644 --- a/internal/util/openshift/predicate.go +++ b/internal/util/openshift/predicate.go @@ -95,7 +95,7 @@ func removeSecretsFromServiceAccount(client client.Client, obj []byte) ([]byte, func removeSecretsFromField(client client.Client, secretsField []interface{}, namespace string) ([]interface{}, error) { for i, s := range secretsField { - if secret, ok := s.(map[string]interface{}); ok { // nolint:nestif + if secret, ok := s.(map[string]interface{}); ok { //nolint:nestif value, mapHasKey := secret["name"] secretName, ok := value.(string) secret := &corev1.Secret{} diff --git a/internal/util/template.go b/internal/util/template.go index 855281fce..b0e3a1861 100644 --- a/internal/util/template.go +++ b/internal/util/template.go @@ -86,7 +86,7 @@ func fromYamlTemplateFunc(value string) (map[string]interface{}, error) { } func valueIfTemplateFunc(value interface{}) (string, error) { - if dict, ok := value.(map[string]interface{}); ok { // nolint:nestif + if dict, ok := value.(map[string]interface{}); ok { //nolint:nestif var value interface{} var key string @@ -148,7 +148,7 @@ func reformatYamlTemplateFunc(value interface{}) (string, error) { func toYamlIfTemplateFunc(value interface{}) (string, error) { sprig.TxtFuncMap() body := []string{} - if dict, ok := value.(map[string]interface{}); ok { // nolint:nestif + if dict, ok := value.(map[string]interface{}); ok { //nolint:nestif if key, ok := dict["key"]; ok { body = append(body, fmt.Sprintf("%s:", key)) }