title: How to detect key press event
body: <p>My purpose is to print string sequentially and when the user enter some character, we pause the process and read stdin content. I know it's possible to catch os.Interrupt signal but I don't how to catch event in stdin.
  I don't want to scan and wait user to enter text. The process is stopped when there is a keypress event.</p>
  <p>My question: How detect event on stdin?</p>
  <p>Here is current solution with your advice. Go routines not constitue an optimal solution because you can't manage them as threads. I currently continue working on this and keep you udpated.</p>
  <pre><code>func main() {
      quit := make(chan bool)
  
      scanner := bufio.NewScanner(os.Stdin)
      for scanner.Scan() {
          fmt.Println(scanner.Text())
          fmt.Println(&quot;-----------------&quot;)
          fmt.Println(&quot;Go routine running :&quot;, runtime.NumGoroutine())
          go func() {
               select {
                  case &lt;-quit:
                  return
               default:
                  fmt.Println(&quot;Text received and changed&quot;)
                  fmt.Println(&quot;-----------------&quot;)
                  for {
                      timer := time.NewTimer(time.Second * 1)
                      &lt;-timer.C
                      fmt.Println(scanner.Text())
                  }
              }
  
              fmt.Println(&quot;Routine closed&quot;)
          }()
  
      }
      if scanner.Err() != nil {
          quit &lt;- false
      }
  }
  </code></pre>
  <p>Otherwise if I follow your solution @varius :</p>
  <pre><code>func main() {
  scanner := bufio.NewScanner(os.Stdin)
  for scanner.Scan() {
      for {
          timer := time.NewTimer(time.Second * 1)
          &lt;-timer.C
          fmt.Println(scanner.Text())
      }
  }
  if scanner.Err() != nil {
   /*handle error*/
  }
  }
  </code></pre>
  <p>But I can't change the scan content while program running.</p>