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