Move golangci-lint config to a file

Make verify-golangci-lint.sh work across modules and take an optional
argument for a package.
This commit is contained in:
Tim Hockin 2021-11-10 12:09:52 -08:00 committed by Antonio Ojea
parent e78b3e8dfe
commit 3bca4e6d67
2 changed files with 29 additions and 8 deletions

18
.golangci.yaml Normal file
View File

@ -0,0 +1,18 @@
run:
timeout: 30m
skip-files:
- "^zz_generated.*"
issues:
max-same-issues: 0
linters:
disable-all: true
enable: # please keep this alphabetized
- deadcode
- ineffassign
- unused
- varcheck
linters-settings: # please keep this alphabetized
unused:
go: "1.17"

View File

@ -43,12 +43,15 @@ popd >/dev/null
cd "${KUBE_ROOT}"
# The config is in ${KUBE_ROOT}/.golangci.yaml
echo 'running golangci-lint '
golangci-lint run \
--timeout 30m \
--disable-all \
-E deadcode \
-E unused \
-E varcheck \
-E ineffassign \
-E staticcheck
if [[ "$#" > 0 ]]; then
golangci-lint run "$@"
else
golangci-lint run ./...
for d in staging/src/k8s.io/*; do
pushd ./vendor/k8s.io/$(basename "$d") >/dev/null
golangci-lint run ./...
popd >/dev/null
done
fi