diff --git a/processor/processor.go b/processor/processor.go index 92c6a37..9aabbeb 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -177,8 +177,7 @@ func (p *processor) getMaxTempetureOnProcessor(tempeturePathGlob string) (maxTem } tempetureReadWaiter := &sync.WaitGroup{} - queue := make(chan float64, len(matches)) - defer close(queue) + queue := make(chan float64, len(matches)-1) // exclude package temp for _, tempetureFilePath := range matches[1:] { @@ -186,6 +185,7 @@ func (p *processor) getMaxTempetureOnProcessor(tempeturePathGlob string) (maxTem go p.readTempeture(tempetureFilePath, queue, tempetureReadWaiter) } tempetureReadWaiter.Wait() + close(queue) for sense := range queue { if maxTempeture < sense { maxTempeture = sense