maybePrintUpdateNotification prints notification about available version.
(ctx context.Context)
| 233 | |
| 234 | // maybePrintUpdateNotification prints notification about available version. |
| 235 | func (c *App) maybePrintUpdateNotification(ctx context.Context) { |
| 236 | if repo.BuildGitHubRepo == "" { |
| 237 | // not built from GH repo. |
| 238 | return |
| 239 | } |
| 240 | |
| 241 | updatedVersion, err := c.maybeCheckForUpdates(ctx) |
| 242 | if err != nil { |
| 243 | log(ctx).Debugf("unable to check for updates: %v", err) |
| 244 | return |
| 245 | } |
| 246 | |
| 247 | if updatedVersion == "" { |
| 248 | log(ctx).Debug("no updated version available") |
| 249 | return |
| 250 | } |
| 251 | |
| 252 | log(ctx).Infof(updateAvailableNoticeFormat, ensureVPrefix(repo.BuildVersion), ensureVPrefix(updatedVersion), repo.BuildGitHubRepo) |
| 253 | } |
| 254 | |
| 255 | func ensureVPrefix(s string) string { |
| 256 | if strings.HasPrefix(s, "v") { |
no test coverage detected