From 367ff0dfd6a47bd87f8c1e7250e6dac6130e5c1c Mon Sep 17 00:00:00 2001 From: Kenneth Date: Mon, 2 Dec 2024 19:34:49 +0000 Subject: [PATCH] fix: use defer to close build output channel --- internal/template/template_manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/template/template_manager.go b/internal/template/template_manager.go index 5bce8e6..fcc348c 100644 --- a/internal/template/template_manager.go +++ b/internal/template/template_manager.go @@ -268,6 +268,8 @@ func (mgr *templateManager) buildTemplate(ctx context.Context, template *templat outputChan := make(chan any) go func() { + defer close(outputChan) + scanner := bufio.NewScanner(res.Body) var imageID string @@ -327,8 +329,6 @@ func (mgr *templateManager) buildTemplate(ctx context.Context, template *templat if img != nil { outputChan <- img } - - close(outputChan) }() return outputChan, nil