Merge pull request #133192 from yongruilin/golangci-lint-config

fix(golangci-lint): skip config verification when -c none is used
This commit is contained in:
Kubernetes Prow Robot
2025-07-24 20:14:41 -07:00
committed by GitHub

View File

@@ -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 <<EOF
if [ "${golangci_config}" ]; then
if ! failures=$( "${GOBIN}/golangci-lint" config verify --config="${golangci_config}" 2>&1 ); then
cat >&2 <<EOF
Verification of the golangci-lint configuration failed. Command:
${GOBIN}/golangci-lint config verify --config="${golangci_config:-}")
${GOBIN}/golangci-lint config verify --config="${golangci_config}")
Result:
$failures
EOF
exit 1
exit 1
fi
fi
if [ "${golangci_config}" ]; then