fix: handle nil debug.BuildInfo for non-go-build binaries

When Helm is built with Bazel (or other build tools that don't populate
debug.BuildInfo), debug.ReadBuildInfo() returns nil, causing a panic.
Add a nil check and fallback to safe defaults.

Fixes #31904

Signed-off-by: Md_Mushfiqur Rahim <20mahin20201@gmail.com>
pull/32157/head
Md_Mushfiqur Rahim 2 months ago
parent 609e1ca72c
commit f798aa5336

@ -26,7 +26,7 @@ import (
func K8sIOClientGoModVersion() (string, error) {
info, ok := debug.ReadBuildInfo()
if !ok {
if !ok || info == nil {
return "", errors.New("failed to read build info")
}

Loading…
Cancel
Save