(ctx context.Context, f *cmdutil.Factory, currentVersion string)
| 315 | } |
| 316 | |
| 317 | func checkForUpdate(ctx context.Context, f *cmdutil.Factory, currentVersion string) (*update.ReleaseInfo, error) { |
| 318 | if updaterEnabled == "" || !update.ShouldCheckForUpdate() { |
| 319 | return nil, nil |
| 320 | } |
| 321 | httpClient, err := f.HttpClient() |
| 322 | if err != nil { |
| 323 | return nil, err |
| 324 | } |
| 325 | stateFilePath := filepath.Join(config.StateDir(), "state.yml") |
| 326 | return update.CheckForUpdate(ctx, httpClient, stateFilePath, updaterEnabled, currentVersion) |
| 327 | } |
| 328 | |
| 329 | func isRecentRelease(publishedAt time.Time) bool { |
| 330 | return !publishedAt.IsZero() && time.Since(publishedAt) < time.Hour*24 |
no test coverage detected