| 473 | } |
| 474 | |
| 475 | func MarkLoadResults(report *SyncReport, inspector PluginLoadInspector) error { |
| 476 | if report == nil { |
| 477 | return nil |
| 478 | } |
| 479 | report.Phase = pluginTaskPhaseLoad |
| 480 | var loadErrors []error |
| 481 | for index := range report.Plugins { |
| 482 | status := &report.Plugins[index] |
| 483 | if status.InstallStatus == pluginInstallStatusFailed { |
| 484 | if status.LoadStatus == "" { |
| 485 | status.LoadStatus = pluginInstallStatusSkipped |
| 486 | } |
| 487 | if strings.TrimSpace(status.Error) != "" { |
| 488 | loadErrors = append(loadErrors, errors.New(status.Error)) |
| 489 | } else { |
| 490 | loadErrors = append(loadErrors, fmt.Errorf("home plugins: plugin %s install failed", status.ID)) |
| 491 | } |
| 492 | continue |
| 493 | } |
| 494 | if inspector != nil && inspector.PluginRegistered(status.ID) { |
| 495 | status.LoadStatus = pluginLoadStatusLoaded |
| 496 | continue |
| 497 | } |
| 498 | status.LoadStatus = pluginLoadStatusFailed |
| 499 | errLoad := fmt.Errorf("home plugins: plugin %s installed but not loaded", status.ID) |
| 500 | if strings.TrimSpace(status.Error) == "" { |
| 501 | status.Error = errLoad.Error() |
| 502 | } |
| 503 | loadErrors = append(loadErrors, errLoad) |
| 504 | } |
| 505 | errLoad := errors.Join(loadErrors...) |
| 506 | finishReport(report, errLoad) |
| 507 | return errLoad |
| 508 | } |
| 509 | |
| 510 | func newSyncReport(platform Platform) SyncReport { |
| 511 | now := time.Now().UTC() |