Guys, you are right. It should work. I made a mistake, the problem was in the surrounding code.
I posted it here https://github.com/korjavin/goscan just for educational purpose. The actual problem wasn't scanner.Scan it was `errs <- err` but it took me hours to understand. Sorry, and thank you! On Friday, December 14, 2018 at 3:28:20 AM UTC+5, Ivan Korjavin wrote: > > I have a goroutenie with scanner.Scan > It looks like: > > ``` > cnn.SetReadDeadline(time.Now().Add(c.rTimeout)) // 10s > scanner := bufio.NewScanner(cnn) > for scanner.Scan() { > ... > } > ``` > cnn is a net.Conn there > > My problem is when I call cnn.Close() (and I tried > cnn.SetReadDeadline(time.Now()) in addition as well) > this scanner.Scan is still running and running and running. > > I would like to close it immediately, but can't find a way how. > > > Please, help me! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.