From e16b0f0dfc90862bf75cd64a49431381d90d85ee Mon Sep 17 00:00:00 2001 From: Oscar Utbult Date: Sat, 22 Oct 2022 14:29:06 +0200 Subject: [PATCH] Update golangci-lint version (1.49.0 -> 1.50.1) and enable linters dupword and testableexamples --- .golangci.yml | 4 +++- Makefile-tools.mk | 2 +- cmd/pluginator/internal/krmfunction/converter.go | 1 + kyaml/filesys/util.go | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c25b1f02a2..cb0b2fbe45 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,6 +17,7 @@ linters: - depguard - dogsled - dupl + - dupword - durationcheck - errcheck - errname @@ -74,6 +75,7 @@ linters: - tagliatelle - tenv - testpackage + - testableexamples - thelper - tparallel - typecheck @@ -88,7 +90,7 @@ linters: - asasalint - usestdlibvars - interfacebloat - - logrlint + - loggercheck - reassign linters-settings: diff --git a/Makefile-tools.mk b/Makefile-tools.mk index d336d48da1..6c64601cae 100644 --- a/Makefile-tools.mk +++ b/Makefile-tools.mk @@ -1,7 +1,7 @@ # Copyright 2022 The Kubernetes Authors. # SPDX-License-Identifier: Apache-2.0 -GOLANGCI_LINT_VERSION=v1.49.0 +GOLANGCI_LINT_VERSION=v1.50.1 MYGOBIN = $(shell go env GOBIN) ifeq ($(MYGOBIN),) diff --git a/cmd/pluginator/internal/krmfunction/converter.go b/cmd/pluginator/internal/krmfunction/converter.go index 6b7c7c3584..ae33d95c13 100644 --- a/cmd/pluginator/internal/krmfunction/converter.go +++ b/cmd/pluginator/internal/krmfunction/converter.go @@ -108,6 +108,7 @@ func (c *Converter) prepareWrapper(content string) string { } // assign to plugin variable if strings.TrimSpace(line) == "var plugin resmap.Configurable" { + //nolint:dupword line += ` // KustomizePlugin is a global variable defined in every plugin plugin = &KustomizePlugin diff --git a/kyaml/filesys/util.go b/kyaml/filesys/util.go index b5ee3dd876..0713ffe2cb 100644 --- a/kyaml/filesys/util.go +++ b/kyaml/filesys/util.go @@ -93,7 +93,7 @@ func PathJoin(incoming []string) string { // relative paths; if it weren't, this function could convert absolute // paths to relative paths, which is not desirable. // -// - For robustness (liberal input, conservative output) Pos values that +// - For robustness (liberal input, conservative output) Pos values // that are too small (large) to index the split filepath result in a // prefix (postfix) rather than an error. Use extreme position values // to assure a prefix or postfix (e.g. 0 will always prefix, and