mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #130647 from alexandear/golangci-fix-forbidigo-settings
hack: fix settings for forbidigo linter
This commit is contained in:
commit
6ef9938e4a
@ -48,7 +48,7 @@ issues:
|
|||||||
# Adding unversioned feature gates is allowed in tests
|
# Adding unversioned feature gates is allowed in tests
|
||||||
- linters:
|
- linters:
|
||||||
- forbidigo
|
- forbidigo
|
||||||
text: should not use MutableFeatureGate.Add, use AddVersioned instead
|
text: should not use Add, use AddVersioned instead
|
||||||
path: _test.go$
|
path: _test.go$
|
||||||
|
|
||||||
# The Kubernetes naming convention for conversion functions uses underscores
|
# The Kubernetes naming convention for conversion functions uses underscores
|
||||||
@ -205,8 +205,7 @@ linters-settings: # please keep this alphabetized
|
|||||||
msg: should not be used because managedFields was removed
|
msg: should not be used because managedFields was removed
|
||||||
- p: \.Add$
|
- p: \.Add$
|
||||||
pkg: ^k8s\.io/component-base/featuregate$
|
pkg: ^k8s\.io/component-base/featuregate$
|
||||||
type: ^MutableFeatureGate$
|
msg: should not use Add, use AddVersioned instead
|
||||||
msg: should not use MutableFeatureGate.Add, use AddVersioned instead
|
|
||||||
- p: ^gomega\.BeTrue$
|
- p: ^gomega\.BeTrue$
|
||||||
pkg: ^github.com/onsi/gomega$
|
pkg: ^github.com/onsi/gomega$
|
||||||
msg: "it does not produce a good failure message - use BeTrueBecause with an explicit printf-style failure message instead, or plain Go: if ... { ginkgo.Fail(...) }"
|
msg: "it does not produce a good failure message - use BeTrueBecause with an explicit printf-style failure message instead, or plain Go: if ... { ginkgo.Fail(...) }"
|
||||||
|
@ -48,7 +48,7 @@ issues:
|
|||||||
# Adding unversioned feature gates is allowed in tests
|
# Adding unversioned feature gates is allowed in tests
|
||||||
- linters:
|
- linters:
|
||||||
- forbidigo
|
- forbidigo
|
||||||
text: should not use MutableFeatureGate.Add, use AddVersioned instead
|
text: should not use Add, use AddVersioned instead
|
||||||
path: _test.go$
|
path: _test.go$
|
||||||
|
|
||||||
# TODO(oscr) Remove these excluded directories and fix findings. Due to large amount of findings in different components
|
# TODO(oscr) Remove these excluded directories and fix findings. Due to large amount of findings in different components
|
||||||
@ -271,8 +271,7 @@ linters-settings: # please keep this alphabetized
|
|||||||
msg: should not be used because managedFields was removed
|
msg: should not be used because managedFields was removed
|
||||||
- p: \.Add$
|
- p: \.Add$
|
||||||
pkg: ^k8s\.io/component-base/featuregate$
|
pkg: ^k8s\.io/component-base/featuregate$
|
||||||
type: ^MutableFeatureGate$
|
msg: should not use Add, use AddVersioned instead
|
||||||
msg: should not use MutableFeatureGate.Add, use AddVersioned instead
|
|
||||||
gocritic:
|
gocritic:
|
||||||
enabled-checks:
|
enabled-checks:
|
||||||
- equalFold
|
- equalFold
|
||||||
|
@ -48,7 +48,7 @@ issues:
|
|||||||
# Adding unversioned feature gates is allowed in tests
|
# Adding unversioned feature gates is allowed in tests
|
||||||
- linters:
|
- linters:
|
||||||
- forbidigo
|
- forbidigo
|
||||||
text: should not use MutableFeatureGate.Add, use AddVersioned instead
|
text: should not use Add, use AddVersioned instead
|
||||||
path: _test.go$
|
path: _test.go$
|
||||||
|
|
||||||
{{- if .Base}}
|
{{- if .Base}}
|
||||||
@ -223,8 +223,7 @@ linters-settings: # please keep this alphabetized
|
|||||||
msg: should not be used because managedFields was removed
|
msg: should not be used because managedFields was removed
|
||||||
- p: \.Add$
|
- p: \.Add$
|
||||||
pkg: ^k8s\.io/component-base/featuregate$
|
pkg: ^k8s\.io/component-base/featuregate$
|
||||||
type: ^MutableFeatureGate$
|
msg: should not use Add, use AddVersioned instead
|
||||||
msg: should not use MutableFeatureGate.Add, use AddVersioned instead
|
|
||||||
{{- if .Hints}}
|
{{- if .Hints}}
|
||||||
- p: ^gomega\.BeTrue$
|
- p: ^gomega\.BeTrue$
|
||||||
pkg: ^github.com/onsi/gomega$
|
pkg: ^github.com/onsi/gomega$
|
||||||
|
@ -129,6 +129,22 @@ if [ "${golangci_config}" ]; then
|
|||||||
GOTOOLCHAIN="$(kube::golang::hack_tools_gotoolchain)" go -C "${KUBE_ROOT}/hack/tools" build -o "${GOBIN}/logcheck.so" -buildmode=plugin sigs.k8s.io/logtools/logcheck/plugin
|
GOTOOLCHAIN="$(kube::golang::hack_tools_gotoolchain)" go -C "${KUBE_ROOT}/hack/tools" build -o "${GOBIN}/logcheck.so" -buildmode=plugin sigs.k8s.io/logtools/logcheck/plugin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Verify that the given config is valid. "golangci-lint run" does not
|
||||||
|
# do that, which makes it easy to miss mistakes while editing the configuration.
|
||||||
|
if ! failures=$( "${GOBIN}/golangci-lint" config verify --config="${golangci_config:-}" 2>&1 ); then
|
||||||
|
cat >&2 <<EOF
|
||||||
|
|
||||||
|
Verification of the golangci-lint configuration failed. Command:
|
||||||
|
|
||||||
|
${GOBIN}/golangci-lint config verify --config="${golangci_config:-}")
|
||||||
|
|
||||||
|
Result:
|
||||||
|
|
||||||
|
$failures
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${golangci_config}" ]; then
|
if [ "${golangci_config}" ]; then
|
||||||
# The relative path to _output/local/bin only works if that actually is the
|
# The relative path to _output/local/bin only works if that actually is the
|
||||||
# GOBIN. If not, then we have to make a temporary copy of the config and
|
# GOBIN. If not, then we have to make a temporary copy of the config and
|
||||||
|
Loading…
Reference in New Issue
Block a user