More error checking in cmd_version

This commit is contained in:
neilotoole 2022-12-30 10:25:45 -07:00
parent 66a8c39844
commit 19aa8c76ff

View File

@ -55,6 +55,9 @@ func execVersion(cmd *cobra.Command, args []string) error {
case latestVersion = <-resultCh:
if latestVersion != "" && !strings.HasPrefix(latestVersion, "v") {
latestVersion = "v" + latestVersion
if !semver.IsValid(latestVersion) {
return errz.Errorf("invalid semver from brew repo: {%s}", latestVersion)
}
}
}