fix: use defer to close build output channel

This commit is contained in:
2024-12-02 19:34:49 +00:00
parent 09b8a6fca4
commit 367ff0dfd6

View File

@@ -268,6 +268,8 @@ func (mgr *templateManager) buildTemplate(ctx context.Context, template *templat
outputChan := make(chan any) outputChan := make(chan any)
go func() { go func() {
defer close(outputChan)
scanner := bufio.NewScanner(res.Body) scanner := bufio.NewScanner(res.Body)
var imageID string var imageID string
@@ -327,8 +329,6 @@ func (mgr *templateManager) buildTemplate(ctx context.Context, template *templat
if img != nil { if img != nil {
outputChan <- img outputChan <- img
} }
close(outputChan)
}() }()
return outputChan, nil return outputChan, nil