Skip to content

Commit dcb5559

Browse files
committed
adding error handling to tag version creation
1 parent 6d5e64d commit dcb5559

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/version/version.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"strings"
2323

2424
"github.com/hashicorp/go-version"
25-
yaml "gopkg.in/yaml.v2"
25+
"gopkg.in/yaml.v2"
2626

2727
"github.com/dapr/cli/pkg/print"
2828
"github.com/dapr/cli/utils"
@@ -120,7 +120,11 @@ func GetLatestReleaseGithub(githubURL string) (string, error) {
120120

121121
for _, release := range githubRepoReleases {
122122
if !strings.Contains(release.TagName, "-rc") {
123-
cur, _ := version.NewVersion(strings.TrimPrefix(release.TagName, "v"))
123+
cur, curErr := version.NewVersion(strings.TrimPrefix(release.TagName, "v"))
124+
if curErr != nil {
125+
print.WarningStatusEvent(os.Stdout, "Failed to parse version: '%s'", curErr)
126+
continue
127+
}
124128
if cur.GreaterThan(latestVersion) {
125129
latestVersion = cur
126130
}

0 commit comments

Comments
 (0)