Skip to content

Commit

Permalink
Only report version check when it can be
Browse files Browse the repository at this point in the history
  • Loading branch information
stoned committed Sep 11, 2022
1 parent 9124783 commit f3fd010
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ func PrintVersion(c *cli.Context) {
outdated, err := AIsNewerThanB(upstreamVersion, Version)
if err != nil {
out += fmt.Sprintf("\n[warning] failed to compare current version with latest: %v\n", err)
}
if outdated {
out += fmt.Sprintf("\n[info] sops %s is available, update with `go get -u go.mozilla.org/sops/v3/cmd/sops`\n", upstreamVersion)
} else {
out += " (latest)\n"
if outdated {
out += fmt.Sprintf("\n[info] sops %s is available, update with `go get -u go.mozilla.org/sops/v3/cmd/sops`\n", upstreamVersion)
} else {
out += " (latest)\n"
}
}
}
fmt.Fprintf(c.App.Writer, "%s", out)
Expand Down

0 comments on commit f3fd010

Please sign in to comment.