Fixing removal of "v" from release version

This commit is contained in:
Phil Kedy 2021-07-14 13:38:42 -04:00
parent 19131133e9
commit 6f2063bd4f
2 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"github.com/dapr/cli/pkg/print" "github.com/dapr/cli/pkg/print"
@ -90,7 +91,7 @@ func getVersion(version string) (string, error) {
if err != nil { if err != nil {
return "", fmt.Errorf("cannot get the latest release version: %s", err) return "", fmt.Errorf("cannot get the latest release version: %s", err)
} }
version = version[1:] version = strings.TrimPrefix(version, "v")
} }
return version, nil return version, nil
} }

View File

@ -104,7 +104,7 @@ func GetLatestReleaseGithub(githubURL string) (string, error) {
for _, release := range githubRepoReleases { for _, release := range githubRepoReleases {
if !strings.Contains(release.TagName, "-rc") { if !strings.Contains(release.TagName, "-rc") {
return release.TagName[1:], nil return strings.TrimPrefix(release.TagName, "v"), nil
} }
} }