From 8cad908cbd336f5d20e1ace6fb9755ad5ef10419 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Fri, 13 May 2022 16:16:28 +0200 Subject: [PATCH] Fix linter issue --- .golangci.yml | 14 +++++++------- main.go | 4 ++++ reaper/types.go | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2e8981d..88db6b1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -61,8 +61,6 @@ linters-settings: alias: - pkg: (k8s.io/api|k8s.io/apimachinery/pkg/apis)/([A-z0-9]+)/([A-z0-9]+) alias: $2$3 - staticcheck: - go: "1.18" lll: line-length: 140 misspell: @@ -89,7 +87,7 @@ linters: - funlen - gocognit - goconst - # - gocritic + - gocritic - gocyclo - godox - gofumpt @@ -97,12 +95,12 @@ linters: - gomoddirectives - gomnd - gosec - - gosimple + # - gosimple - govet - ifshort - importas - ineffassign - # - ireturn - enable later + - ireturn - lll - misspell - nakedret @@ -110,13 +108,14 @@ linters: - nilnil - noctx - nolintlint + - nosprintfhostport - paralleltest - prealloc - predeclared - promlinter - - staticcheck + # - staticcheck - structcheck - - stylecheck + # - stylecheck - tenv - testpackage - thelper @@ -143,6 +142,7 @@ issues: - deadcode run: + go: "1.18" skip-files: - ".*.mock.\\.go$" modules-download-mode: readonly diff --git a/main.go b/main.go index 99b416c..4a0ad37 100644 --- a/main.go +++ b/main.go @@ -119,6 +119,8 @@ func loadRestConfig() (cfg *rest.Config, err error) { return clientcmd.BuildConfigFromFlags("", kubeconfig) } +//nolint:nolintlint // false postivie +//nolint:ireturn // false positive func lookupEnvOr[T any](envKey string, fallback T, parse func(envVal string) (T, error)) T { envVal := os.Getenv(envKey) if envVal == "" { @@ -132,6 +134,8 @@ func lookupEnvOr[T any](envKey string, fallback T, parse func(envVal string) (T, } } +//nolint:nolintlint // false postivie +//nolint:ireturn // false positive func identity[T any](in T) (T, error) { return in, nil } diff --git a/reaper/types.go b/reaper/types.go index a770cf6..a195f60 100644 --- a/reaper/types.go +++ b/reaper/types.go @@ -23,6 +23,8 @@ func ParseTarget(val string) (Target, error) { type Target string +//nolint:nolintlint // false postivie +//nolint:ireturn // no over option due to upstream library func (t Target) Selector() (labels.Selector, error) { s := string(t) if s == "" {