From 5091f930159f124f4785b0ebcd02031e0d61e3bf Mon Sep 17 00:00:00 2001 From: Tibi <110664232+TiberiuGC@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:36:46 +0300 Subject: [PATCH] Don't close error channel early when wait flag is used (#7217) --- pkg/actions/addon/tasks.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/actions/addon/tasks.go b/pkg/actions/addon/tasks.go index d81837335a..f0f618b48f 100644 --- a/pkg/actions/addon/tasks.go +++ b/pkg/actions/addon/tasks.go @@ -119,8 +119,6 @@ type deleteAddonIAMTask struct { func (t *deleteAddonIAMTask) Describe() string { return t.info } func (t *deleteAddonIAMTask) Do(errorCh chan error) error { - defer close(errorCh) - errMsg := fmt.Sprintf("deleting addon IAM %q", *t.stack.StackName) if t.wait { if err := t.stackManager.DeleteStackBySpecSync(t.ctx, t.stack, errorCh); err != nil { @@ -128,6 +126,7 @@ func (t *deleteAddonIAMTask) Do(errorCh chan error) error { } return nil } + defer close(errorCh) if _, err := t.stackManager.DeleteStackBySpec(t.ctx, t.stack); err != nil { return fmt.Errorf("%s: %w", errMsg, err) }