mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #113256 from oscr/enable-gocritic-check
hack/tools enable additional linter gocritic in golangci-lint
This commit is contained in:
commit
641197dc95
@ -7,14 +7,20 @@ issues:
|
|||||||
max-same-issues: 0
|
max-same-issues: 0
|
||||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
# exclude ineffassing linter for generated files for conversion
|
# exclude ineffassign linter for generated files for conversion
|
||||||
- path: conversion\.go
|
- path: conversion\.go
|
||||||
linters:
|
linters:
|
||||||
- ineffassign
|
- ineffassign
|
||||||
|
# TODO(oscr) Remove these excluded directories and fix findings. Due to large amount of findings in different components
|
||||||
|
# with different owners it's hard to fix everything in a single pr. This will therefore be done in multiple prs.
|
||||||
|
- path: (pkg/volume/*|test/*|cmd/kubeadm/*|azure/*|pkg/cmd/wait*|request/bearertoken/*|metrics/*|filters/*)
|
||||||
|
linters:
|
||||||
|
- gocritic
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable: # please keep this alphabetized
|
enable: # please keep this alphabetized
|
||||||
|
- gocritic
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- logcheck
|
- logcheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
@ -28,6 +34,10 @@ linters-settings: # please keep this alphabetized
|
|||||||
path: _output/local/bin/logcheck.so
|
path: _output/local/bin/logcheck.so
|
||||||
description: structured logging checker
|
description: structured logging checker
|
||||||
original-url: k8s.io/klog/hack/tools
|
original-url: k8s.io/klog/hack/tools
|
||||||
|
gocritic:
|
||||||
|
enabled-checks:
|
||||||
|
- equalFold
|
||||||
|
- boolExprSimplify
|
||||||
staticcheck:
|
staticcheck:
|
||||||
checks: [
|
checks: [
|
||||||
"all",
|
"all",
|
||||||
|
@ -41,7 +41,7 @@ func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtim
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.ToLower(gvk.Kind) == "status" && gvk.Version == "v1" && (gvk.Group == "" || gvk.Group == "meta.k8s.io") {
|
if strings.EqualFold(gvk.Kind, "status") && gvk.Version == "v1" && (gvk.Group == "" || gvk.Group == "meta.k8s.io") {
|
||||||
if _, ok := obj.(*metav1.Status); !ok {
|
if _, ok := obj.(*metav1.Status); !ok {
|
||||||
obj = &metav1.Status{}
|
obj = &metav1.Status{}
|
||||||
err := json.Unmarshal(data, obj)
|
err := json.Unmarshal(data, obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user