fix: use defer to close build output channel
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user