From d4a83b9a522355cf3fb3b10745ee3b8a7bb888d0 Mon Sep 17 00:00:00 2001 From: yongruilin Date: Thu, 24 Jul 2025 21:41:28 +0000 Subject: [PATCH] fix(golangci-lint): skip config verification when -c none is used Prevents failure when no config file is specified by only verifying config when golangci_config is non-empty. --- hack/verify-golangci-lint.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hack/verify-golangci-lint.sh b/hack/verify-golangci-lint.sh index 784105e0c3c..91550203cbe 100755 --- a/hack/verify-golangci-lint.sh +++ b/hack/verify-golangci-lint.sh @@ -140,20 +140,22 @@ if [ "${golangci_config}" ]; then GOTOOLCHAIN="$(kube::golang::hack_tools_gotoolchain)" go -C "${KUBE_ROOT}/hack/tools/golangci-lint" build -o "${GOBIN}/sorted.so" -buildmode=plugin k8s.io/kubernetes/hack/tools/golangci-lint/sorted/plugin fi -# Verify that the given config is valid. "golangci-lint run" does not +# Verify that the given config is valid (if one is provided). "golangci-lint run" does not # do that, which makes it easy to miss mistakes while editing the configuration. -if ! failures=$( "${GOBIN}/golangci-lint" config verify --config="${golangci_config:-}" 2>&1 ); then - cat >&2 <&1 ); then + cat >&2 <