I'm currently utilizing the bufio.NewScanner to read ASCII data from a 
serial port.  I have the following simple code:

ns := bufio.NewScanner(sPort)

for {
   ns.Scan()
   if ns.Text() != "" { // ignore blank lines
      // handle content here
   }
}

The problem is ns.Scan() blocks the loop from continuing if there isn't any 
data.  This leaves me unable to break out of the loop with a for condition 
or a select statement also within the loop which is looking for a close 
command from a channel before or after it, etc.  Am I doing something 
wrong, or is there a proper way to handle this?

-- 
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.

Reply via email to