My code is little complex, but in simple terms it is having multiple go routines, all dial-ing different tcp server and reading the input in a for loop when a readable message is present over the stream. So far so good. Now there is another go routine which manages the previous bunch of 'clients' and closes them when user wants to. For that I have associated each 'conn' with appropriate go routine client and closing that.
The problem what I am facing is as soon as I call the close function of any conn object, its' corresponding Read function goes in an infinite loop reading just the empty strings continuously.
I wrote a simple code which is similar to the way I am handling the connections in multiple go routines- https://play.golang.org/p/wq7zt9Kqz7
TL;DR
In short I have a 'class' which represents one remote server with its address, conn, waitgroup with in it and I am creating its multiple instances and handling for their inputs in separate go routines. And in another go routine I am trying to close one of those instance and this read() goes in a loop indefinitely.