I'm a newbie to Go, so don't be angry :D

I need to read user input from console. Sounds pretty easy, but I need to get it without user pressing “Enter” key. It should be possible. Please help me.

1 Like

Hi @Tigran_Kashapov welcome to the community!

While I have not tried to stream data from the terminal into a Go program I did find the link below after a little searching. I wish I could be a better help but hopefully this will at least get you on the right path to solving your problem.

1 Like

ok, thanks a lot. I’ll try this right now

2 Likes

Let me know if you get it working! I’d love to learn.

1 Like

Unfortunately, It isn’t working

1 Like

I solved this problem via library called “keyboard”. (github.com/eiannone/keyboard)

2 Likes

Hi,

Most of the time, when you think keyboard you mean standard input. You could avoid using a third party library with something explained here under the section “Reading Single UTF-8 Encoded Unicode Characters”.
The idea is to use a Reader to read runes from standard input.
Have a nice day.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.