title: Golang reading from stdin, how to detect special keys (enter, backspace... etc)
body: <p>I have the following program that reads user input from stdin:</p>
  
  <pre><code>var input string = ""
              exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run()
              exec.Command("stty", "-F", "/dev/tty", "-echo").Run()
              var b []byte = make([]byte, 1)
              for {
                  input += string(b)
              }
  </code></pre>
  
  <p>I want to place some kind of condition inside the for loop so that i can "break" when the user presses "enter" (for example) or remove one char from a string when the user presses (backspace). However, i can't figure out what the byte array or string representation of those two keys are. How do i go about figuring this out ? enter just prints a \w and backspace prins an undefined character.</p>