Tidy
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Rob Watson 2022-06-15 20:29:33 +02:00
parent e33612cced
commit 07552d10dd
1 changed files with 4 additions and 4 deletions

View File

@ -216,22 +216,22 @@ func copyLogStream(ctx context.Context, wg *sync.WaitGroup, client KubernetesCli
// Closing the reader ensures that the goroutine below is not leaked. // Closing the reader ensures that the goroutine below is not leaked.
defer func() { _ = logReader.Close() }() defer func() { _ = logReader.Close() }()
done := make(chan error, 1) errch := make(chan error, 1)
go func() { go func() {
defer close(done) defer close(errch)
scanner := bufio.NewScanner(logReader) scanner := bufio.NewScanner(logReader)
for scanner.Scan() { for scanner.Scan() {
logsLines <- "[" + stream.podName + "] " + scanner.Text() + nl logsLines <- "[" + stream.podName + "] " + scanner.Text() + nl
} }
if err := scanner.Err(); err != nil { if err := scanner.Err(); err != nil {
done <- newLogError(fmt.Errorf("error scanning logs: %v", err), stream) errch <- newLogError(fmt.Errorf("error scanning logs: %v", err), stream)
return return
} }
}() }()
for { for {
select { select {
case err := <-done: case err := <-errch:
return err return err
case <-stream.done: case <-stream.done:
return nil return nil