File tree 8 files changed +45
-118
lines changed
8 files changed +45
-118
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,17 @@ linters:
21
21
# - structcheck
22
22
# - varcheck
23
23
- ineffassign
24
+ - logcheck
24
25
- staticcheck
25
26
- unused
26
27
27
28
linters-settings : # please keep this alphabetized
29
+ custom :
30
+ logcheck :
31
+ # Installed there by hack/verify-golangci-lint.sh.
32
+ path : _output/local/bin/logcheck.so
33
+ description : structured logging checker
34
+ original-url : k8s.io/klog/hack/tools
28
35
staticcheck :
29
36
go : " 1.17"
30
37
checks : [
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # This file contains regular expressions that are matched against <pkg>/<file>,
2
+ # for example k8s.io/cmd/kube-scheduler/app/config/config.go.
3
+ #
4
+ # By default, structured logging call parameters are checked, but usage of
5
+ # those calls is not required. That is changed on a per-file basis.
6
+ #
7
+ # Remember to clean the golangci-lint cache when changing the configuration and
8
+ # running the verify-golangci-lint.sh script multiple times, otherwise
9
+ # golangci-lint will report stale results:
10
+ # _output/local/bin/golangci-lint cache clean
11
+
12
+ # At this point we don't enforce the usage structured logging calls except in
13
+ # those packages that were migrated. This disables the check for other files.
14
+ -structured .*
15
+
16
+ # Now enable it again for migrated packages.
17
+ structured k8s.io/kubernetes/cmd/kube-proxy/.*
18
+ structured k8s.io/kubernetes/cmd/kube-scheduler/.*
19
+ structured k8s.io/kubernetes/cmd/kubelet/.*
20
+ structured k8s.io/kubernetes/pkg/kubelet/.*
21
+ structured k8s.io/kubernetes/pkg/proxy/.*
22
+ structured k8s.io/kubernetes/pkg/scheduler/.*
Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ EXCLUDED_PATTERNS=(
35
35
" verify-linkcheck.sh" # runs in separate Jenkins job once per day due to high network usage
36
36
" verify-*-dockerized.sh" # Don't run any scripts that intended to be run dockerized
37
37
" verify-govet-levee.sh" # Do not run levee analysis by default while KEP-1933 implementation is in alpha.
38
- " verify-structured-logging.sh" # TODO(dims) Need to get this running with golang 1.18
39
38
)
40
39
41
40
# Exclude generated-files-remake in certain cases, if they're running in a separate job.
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ require (
11
11
github.com/google/go-flow-levee v0.1.5
12
12
gotest.tools/gotestsum v1.6.4
13
13
honnef.co/go/tools v0.2.2
14
- k8s.io/klog/hack/tools v0.0.0-20210917071902-331d2323a192
14
+ k8s.io/klog/hack/tools v0.0.0-20220321210246-c697110cd8ac
15
15
sigs.k8s.io/zeitgeist v0.2.0
16
16
)
Original file line number Diff line number Diff line change @@ -1521,8 +1521,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
1521
1521
honnef.co/go/tools v0.0.1-2020.1.4 /go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k =
1522
1522
honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk =
1523
1523
honnef.co/go/tools v0.2.2 /go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY =
1524
- k8s.io/klog/hack/tools v0.0.0-20210917071902-331d2323a192 h1:u27Xm1of9MTDM1CZW3hg0Vv04ohywEG152G8mpr9n8Y =
1525
- k8s.io/klog/hack/tools v0.0.0-20210917071902-331d2323a192 /go.mod h1:DXW3Mv8xqJvjXWiBSBHrK2O4mq5LMD0clqkv3b1g9HA =
1524
+ k8s.io/klog/hack/tools v0.0.0-20220321210246-c697110cd8ac h1:c2NQfDLtcwrPdD9pnUcRPlMJ719zgRzdlufHULIW7mU =
1525
+ k8s.io/klog/hack/tools v0.0.0-20220321210246-c697110cd8ac /go.mod h1:DXW3Mv8xqJvjXWiBSBHrK2O4mq5LMD0clqkv3b1g9HA =
1526
1526
k8s.io/klog/v2 v2.0.0 /go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE =
1527
1527
k8s.io/utils v0.0.0-20210802155522-efc7438f0176 /go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA =
1528
1528
mvdan.cc/gofumpt v0.3.0 h1:kTojdZo9AcEYbQYhGuLf/zszYthRdhDNDUi2JKTxas4 =
Original file line number Diff line number Diff line change @@ -36,14 +36,25 @@ PATH="${GOBIN}:${PATH}"
36
36
export GO111MODULE=on
37
37
38
38
# Install golangci-lint
39
- echo ' installing golangci-lint '
39
+ echo " installing golangci-lint and logcheck plugin from hack/tools into ${GOBIN} "
40
40
pushd " ${KUBE_ROOT} /hack/tools" > /dev/null
41
41
go install github.com/golangci/golangci-lint/cmd/golangci-lint
42
+ go build -o " ${GOBIN} /logcheck.so" -buildmode=plugin k8s.io/klog/hack/tools/logcheck/plugin
42
43
popd > /dev/null
43
44
44
45
cd " ${KUBE_ROOT} "
45
46
46
- # The config is in ${KUBE_ROOT}/.golangci.yaml
47
+ # The config is in ${KUBE_ROOT}/.golangci.yaml where it will be found
48
+ # even when golangci-lint is invoked in a sub-directory.
49
+ #
50
+ # The logcheck plugin currently has to be configured via env variables
51
+ # (https://github.com/golangci/golangci-lint/issues/1512).
52
+ #
53
+ # Remember to clean the golangci-lint cache when changing
54
+ # the configuration and running this script multiple times,
55
+ # otherwise golangci-lint will report stale results:
56
+ # _output/local/bin/golangci-lint cache clean
57
+ export LOGCHECK_CONFIG=" ${KUBE_ROOT} /hack/logcheck.conf"
47
58
echo ' running golangci-lint ' >&2
48
59
res=0
49
60
if [[ " $# " -gt 0 ]]; then
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments