Split off helper function

This commit is contained in:
Joshua Casey 2023-08-28 12:14:14 -05:00
parent 38230fc518
commit 2dcc149fee

View File

@ -73,11 +73,15 @@ func Get() apimachineryversion.Info {
} }
} }
if info.GitVersion == "v0.0.0" && info.GitCommit != "" { ensureFakeDevVersion(&info)
return info
}
func ensureFakeDevVersion(info *apimachineryversion.Info) {
if info != nil && info.GitVersion == "v0.0.0" && info.GitCommit != "" {
info.GitVersion += fmt.Sprintf("-%s-%s", info.GitVersion += fmt.Sprintf("-%s-%s",
k8sstrings.ShortenString(info.GitCommit, 8), k8sstrings.ShortenString(info.GitCommit, 8),
info.GitTreeState) info.GitTreeState)
} }
return info
} }