(ctx context.Context, f *cmdutil.Factory, currentVersion string)
| 328 | } |
| 329 | |
| 330 | func checkForUpdate(ctx context.Context, f *cmdutil.Factory, currentVersion string) (*update.ReleaseInfo, error) { |
| 331 | if updaterEnabled == "" || !update.ShouldCheckForUpdate() { |
| 332 | return nil, nil |
| 333 | } |
| 334 | httpClient, err := f.HttpClient() |
| 335 | if err != nil { |
| 336 | return nil, err |
| 337 | } |
| 338 | stateFilePath := filepath.Join(config.StateDir(), "state.yml") |
| 339 | return update.CheckForUpdate(ctx, httpClient, stateFilePath, updaterEnabled, currentVersion) |
| 340 | } |
| 341 | |
| 342 | func isRecentRelease(publishedAt time.Time) bool { |
| 343 | return !publishedAt.IsZero() && time.Since(publishedAt) < time.Hour*24 |
no test coverage detected