That is not Go specific; the OS does the line-buffering. You could use e.g. termbox <https://godoc.org/github.com/nsf/termbox-go> to disable that.
On Tue, Nov 28, 2017 at 6:12 AM, dc0d <kaveh.shahbaz...@gmail.com> wrote: > For example I want the program to exit, if any key has been pressed on > keyboard. I can not find any way to skip the wait for a necessary split > character (like '\n'). > > On Monday, November 27, 2017 at 6:36:35 PM UTC+3:30, Jan Mercl wrote: >> >> On Mon, Nov 27, 2017 at 4:00 PM dc0d <kaveh.sh...@gmail.com> wrote: >> >> > Is there a way to read from `os.Stdin` in an unbuffered way? (Not >> waiting for a `\n` or anything). >> >> n, err := os.Stdin.Read(buf) >> >> does not wait for `\n`. Or do you actually mean setting a terminal in raw >> mode? Because os.Stdin does not have to be a terminal. >> >> >> >> -- >> >> -j >> > -- > 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. > -- 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.