From e1128694fd3e61621b3c0052c84a6eb03253f1f0 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Fri, 4 Oct 2024 19:01:59 +0800 Subject: [PATCH] fix: fix slice init length Signed-off-by: cuishuang --- internal/argocd/health.go | 6 +++--- internal/directives/argocd_health.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/argocd/health.go b/internal/argocd/health.go index bf8143f3e..5d8a20a58 100644 --- a/internal/argocd/health.go +++ b/internal/argocd/health.go @@ -171,14 +171,14 @@ func (h *applicationHealth) GetApplicationHealth( // e.g. the health status result to become unreliable. if errConditions := filterAppConditions(app, healthErrorConditions...); len(errConditions) > 0 { issues := make([]error, len(errConditions)) - for _, condition := range errConditions { - issues = append(issues, fmt.Errorf( + for i, condition := range errConditions { + issues[i] = fmt.Errorf( "Argo CD Application %q in namespace %q has %q condition: %s", appKey.Name, appKey.Namespace, condition.Type, condition.Message, - )) + ) } return kargoapi.HealthStateUnhealthy, healthStatus, syncStatus, errors.Join(issues...) } diff --git a/internal/directives/argocd_health.go b/internal/directives/argocd_health.go index 2529c1e95..315200475 100644 --- a/internal/directives/argocd_health.go +++ b/internal/directives/argocd_health.go @@ -184,14 +184,14 @@ func (a *argocdUpdater) getApplicationHealth( // e.g. the health status result to become unreliable. if errConditions := a.filterAppConditions(app, healthErrorConditions...); len(errConditions) > 0 { issues := make([]error, len(errConditions)) - for _, condition := range errConditions { - issues = append(issues, fmt.Errorf( + for i, condition := range errConditions { + issues[i] = fmt.Errorf( "Argo CD Application %q in namespace %q has %q condition: %s", appKey.Name, appKey.Namespace, condition.Type, condition.Message, - )) + ) } return kargoapi.HealthStateUnhealthy, appStatus, errors.Join(issues...) }