title: How to react to keypress events in Go?
body: <p>I have a REPL app in Go that should react to keyboard press events (distinct action for each key pressed key) but <code>ReadString</code> expects for return key to be pressed before reading <code>os.Stdin</code>:</p>
  
  <pre><code>import (
      "bufio"
      "os"
  )
  
  for {
      reader := bufio.NewReader(os.Stdin)
      key, _ := reader.ReadString('\n')
      deferKey(key)
  }
  </code></pre>
  
  <p>How can I react to key press events in Go?</p>