From 10d29424d1e26d48aadcd8736d1adc0cb201a5ca Mon Sep 17 00:00:00 2001 From: Ed <4785890+edwardfward@users.noreply.github.com> Date: Fri, 22 Nov 2024 07:38:43 -0600 Subject: [PATCH] adding error handling to tag version creation Signed-off-by: Ed <4785890+edwardfward@users.noreply.github.com> --- pkg/version/version.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/version/version.go b/pkg/version/version.go index d25f6d92e..30d1742c7 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -22,7 +22,7 @@ import ( "strings" "github.com/hashicorp/go-version" - yaml "gopkg.in/yaml.v2" + "gopkg.in/yaml.v2" "github.com/dapr/cli/pkg/print" "github.com/dapr/cli/utils" @@ -120,7 +120,11 @@ func GetLatestReleaseGithub(githubURL string) (string, error) { for _, release := range githubRepoReleases { if !strings.Contains(release.TagName, "-rc") { - cur, _ := version.NewVersion(strings.TrimPrefix(release.TagName, "v")) + cur, curErr := version.NewVersion(strings.TrimPrefix(release.TagName, "v")) + if curErr != nil { + print.WarningStatusEvent(os.Stdout, "Failed to parse version: '%s'", curErr) + continue + } if cur.GreaterThan(latestVersion) { latestVersion = cur }