Update golangci-lint version (1.49.0 -> 1.50.1) and enable linters dupword and testableexamples

This commit is contained in:
Oscar Utbult
2022-10-22 14:29:06 +02:00
parent 997e6fcc63
commit e16b0f0dfc
4 changed files with 6 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ linters:
- depguard - depguard
- dogsled - dogsled
- dupl - dupl
- dupword
- durationcheck - durationcheck
- errcheck - errcheck
- errname - errname
@@ -74,6 +75,7 @@ linters:
- tagliatelle - tagliatelle
- tenv - tenv
- testpackage - testpackage
- testableexamples
- thelper - thelper
- tparallel - tparallel
- typecheck - typecheck
@@ -88,7 +90,7 @@ linters:
- asasalint - asasalint
- usestdlibvars - usestdlibvars
- interfacebloat - interfacebloat
- logrlint - loggercheck
- reassign - reassign
linters-settings: linters-settings:

View File

@@ -1,7 +1,7 @@
# Copyright 2022 The Kubernetes Authors. # Copyright 2022 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
GOLANGCI_LINT_VERSION=v1.49.0 GOLANGCI_LINT_VERSION=v1.50.1
MYGOBIN = $(shell go env GOBIN) MYGOBIN = $(shell go env GOBIN)
ifeq ($(MYGOBIN),) ifeq ($(MYGOBIN),)

View File

@@ -108,6 +108,7 @@ func (c *Converter) prepareWrapper(content string) string {
} }
// assign to plugin variable // assign to plugin variable
if strings.TrimSpace(line) == "var plugin resmap.Configurable" { if strings.TrimSpace(line) == "var plugin resmap.Configurable" {
//nolint:dupword
line += ` line += `
// KustomizePlugin is a global variable defined in every plugin // KustomizePlugin is a global variable defined in every plugin
plugin = &KustomizePlugin plugin = &KustomizePlugin

View File

@@ -93,7 +93,7 @@ func PathJoin(incoming []string) string {
// relative paths; if it weren't, this function could convert absolute // relative paths; if it weren't, this function could convert absolute
// paths to relative paths, which is not desirable. // 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 // that are too small (large) to index the split filepath result in a
// prefix (postfix) rather than an error. Use extreme position values // prefix (postfix) rather than an error. Use extreme position values
// to assure a prefix or postfix (e.g. 0 will always prefix, and // to assure a prefix or postfix (e.g. 0 will always prefix, and