(ctx context.Context, f *cmdutil.Factory, currentVersion string)
| 356 | } |
| 357 | |
| 358 | func checkForUpdate(ctx context.Context, f *cmdutil.Factory, currentVersion string) (*update.ReleaseInfo, error) { |
| 359 | if updaterEnabled == "" || !update.ShouldCheckForUpdate() { |
| 360 | return nil, nil |
| 361 | } |
| 362 | httpClient, err := f.HttpClient() |
| 363 | if err != nil { |
| 364 | return nil, err |
| 365 | } |
| 366 | stateFilePath := filepath.Join(config.StateDir(), "state.yml") |
| 367 | return update.CheckForUpdate(ctx, httpClient, stateFilePath, updaterEnabled, currentVersion) |
| 368 | } |
| 369 | |
| 370 | func isRecentRelease(publishedAt time.Time) bool { |
| 371 | return !publishedAt.IsZero() && time.Since(publishedAt) < time.Hour*24 |
no test coverage detected