In the below code:
data.WaitForGoroutine.Add(1)
go func() {
for {
select {
case msg := <-someCh:
data.DataCh <- fmt.Sprintf("Received messages: key %s, value: %s\n", string(msg.Key), string(msg.Value))
case <-data.Signal:
close(data.DataCh)
break
}
}
data.WaitForGoroutine.Done()
}()
Linter complains that data.WaitForGoroutine.Done()
is unreachable code.
Doesn't break
break from for{}
?