Skip to content

Commit

Permalink
Fix version check (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink authored May 30, 2024
1 parent 464ec4a commit 8ad822e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,19 +287,21 @@ func checkVersion(logger output.Logger) {
return
}

latestVersion, ok := versions["stable"].(string)
latestVersionRaw, ok := versions["stable"].(string)
if !ok {
return
}

latestVersion := fmt.Sprintf("v%s", strings.TrimPrefix(latestVersionRaw, "v"))

currentVersion := build.Semver()
if isDevelopment() {
return // avoid warning in local development
}

if currentVersion != latestVersion {
logger.Info(fmt.Sprintf(
"\n%s Version warning: a new version of Flow CLI is available (v%s).\n"+
"\n%s Version warning: a new version of Flow CLI is available (%s).\n"+
" Read the installation guide for upgrade instructions: https://docs.onflow.org/flow-cli/install\n",
output.WarningEmoji(),
strings.ReplaceAll(latestVersion, "\n", ""),
Expand Down

0 comments on commit 8ad822e

Please sign in to comment.