Commit Graph

12 Commits

Author SHA1 Message Date
Patrick Ohly
fd8523aa08 golangci-lint: enable running specific linters
To run just a specific linter based on command line flags, the default
configuration needs to be disabled (because it would enable additional ones)
and then command line flags must be passed through to "golangci-lint run".

For example, to lint with just "go vet" in verbose mode, use:

    verify-golangci-lint.sh -c none -- --disable-all --enable=govet -v
2023-03-03 07:51:04 +01:00
Patrick Ohly
cf2e6291d1 hack: move golangci-lint config files
Because the script now explicitly selects the configuration file, the files no
longer have to be in the root directory. Having them in hack without the
leading dot is better because they then have the same owners as the script and
are more visible.

The downside is that manual invocations of golangci-lint without the parameter
no longer work.
2023-02-28 17:22:31 +01:00
Patrick Ohly
2d513e1330 golangci-lint: show more information about actual invocation
Both env variables and parameters are relevant for users who want to invoke the
command directly or follow how it is used.
2023-02-28 17:21:52 +01:00
Davanum Srinivas
a2408f39c7
[golang] Fix things commented out in 1.19rc2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-08-04 10:27:09 -04:00
Davanum Srinivas
6c0a434db0
Try disabling logcheck for golang 1.19rc2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Patrick Ohly
0284c6c06e hack/tools: use logcheck v0.1.0 from sigs.k8s.io/logtools/logcheck
The code was moved out of k8s.io/klog into its own repo with proper
tagging. Functionally there is no difference.
2022-06-14 17:27:16 +02:00
Patrick Ohly
17e3c555c5 hack: integrate logcheck into golangci-lint
Running logcheck as part of golangci-lint has several advantages:
- faster checking because finding files and parsing is shared
  with other linters
- gets rid of the complex and buggy
  hack/verify-structured-logging.sh (https://github.com/kubernetes/kubernetes/issues/106746)
- support for // nolint:logcheck
- works with Go 1.18
2022-03-24 11:21:03 +01:00
Antonio Ojea
272b31da50 use golangci-lint and remove legacy verify-staticcheck.sh 2021-11-17 13:58:53 +01:00
Tim Hockin
3bca4e6d67 Move golangci-lint config to a file
Make verify-golangci-lint.sh work across modules and take an optional
argument for a package.
2021-11-17 08:56:57 +01:00
Hanna Lee
7ea01c0bdb Add staticcheck to verify-golangci-lint.sh 2021-11-17 08:56:01 +01:00
Supriya Premkumar
e52e5e486c
Adds ineffassign to GO linter script.
Changes:
 - Enables ineffassign check in the verify scripts.
 - Fixes lint errs.
2021-03-03 08:28:10 -08:00
Davanum Srinivas
865fd2f04f
Use golangci-lint to find unused/dead code
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-02-19 12:12:02 -05:00