From bfc42902853ec657052d5d3f75dec82bd737cd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Tue, 10 May 2022 17:50:04 +0200 Subject: [PATCH] chore: enable more linters (#3862) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: enable deadcode and unused linters Signed-off-by: Charles-Edouard Brétéché * chore: enable more linters Signed-off-by: Charles-Edouard Brétéché --- .golangci.yml | 12 +++++++----- cmd/initContainer/main.go | 11 +++++------ pkg/autogen/autogen.go | 1 - pkg/tls/certRenewer.go | 2 +- pkg/tls/reader.go | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 07c95c6297..bc71d7ce09 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,18 +1,20 @@ linters: enable: + - bodyclose - deadcode - errcheck - gosec - gosimple - - bodyclose - - staticcheck - - unused - disable: + - govet - ineffassign + - staticcheck - structcheck + - typecheck + - unused + - varcheck run: timeout: 5m skip-files: - ".+_test.go" - - ".+_test_.+.go" \ No newline at end of file + - ".+_test_.+.go" diff --git a/cmd/initContainer/main.go b/cmd/initContainer/main.go index fe2098abde..7c76f67e73 100644 --- a/cmd/initContainer/main.go +++ b/cmd/initContainer/main.go @@ -107,13 +107,13 @@ func main() { } requests := []request{ - {policyReportKind, ""}, - {clusterPolicyReportKind, ""}, + {policyReportKind}, + {clusterPolicyReportKind}, - {reportChangeRequestKind, ""}, - {clusterReportChangeRequestKind, ""}, + {reportChangeRequestKind}, + {clusterReportChangeRequestKind}, - {convertGenerateRequest, ""}, + {convertGenerateRequest}, } ctx, cancel := context.WithCancel(context.Background()) @@ -253,7 +253,6 @@ func executeRequest(client client.Interface, kyvernoclient kyvernoclient.Interfa type request struct { kind string - name string } /* Processing Pipeline diff --git a/pkg/autogen/autogen.go b/pkg/autogen/autogen.go index bb84883532..670f8e5600 100644 --- a/pkg/autogen/autogen.go +++ b/pkg/autogen/autogen.go @@ -199,7 +199,6 @@ func GenerateRulePatches(spec *kyverno.Spec, controllers string) (rulePatches [] rulePatches = append(rulePatches, pbytes) } insertIdx++ - patchPostion = insertIdx } } return diff --git a/pkg/tls/certRenewer.go b/pkg/tls/certRenewer.go index 11a9a26e1f..f9f3370b00 100644 --- a/pkg/tls/certRenewer.go +++ b/pkg/tls/certRenewer.go @@ -405,7 +405,7 @@ func GenerateRootCASecretName(props *CertificateProps) string { } func CanAddAnnotationToSecret(deplHash string, secret *v1.Secret) bool { - var deplHashSec string = "default" + var deplHashSec string var ok, managedByKyverno bool if label, ok := secret.GetLabels()[ManagedByLabel]; ok { diff --git a/pkg/tls/reader.go b/pkg/tls/reader.go index 77bb2d247c..a25bcd448d 100644 --- a/pkg/tls/reader.go +++ b/pkg/tls/reader.go @@ -29,7 +29,7 @@ func ReadRootCASecret(restConfig *rest.Config, client kubernetes.Interface) (res deplHash = fmt.Sprintf("%v", depl.GetUID()) } - var deplHashSec string = "default" + var deplHashSec string var ok, managedByKyverno bool sname := GenerateRootCASecretName(certProps) @@ -68,7 +68,7 @@ func ReadTLSPair(restConfig *rest.Config, client kubernetes.Interface) (*PemPair deplHash = fmt.Sprintf("%v", depl.GetUID()) } - var deplHashSec string = "default" + var deplHashSec string var ok, managedByKyverno bool sname := GenerateTLSPairSecretName(certProps)