全部。我正在用 Go 编写一个聊天客户端,作为我正在编写的库的概念验证。它需要接受用户输入并在同一个终端窗口中打印传入的消息。考虑以下。
user@debian ~ $ ./client
no session> 192.168.1.100
> Hello, there!
Hi!
> So, did you get that feature working yet?
Nope. I thought you were going to ask on StackOverflow.
>> Yeah, I'm aski
如果在我打字时有另一条消息到达,那么它应该产生以下内容。
user@debian ~ $ ./client
no session> 192.168.1.100
> Hello, there!
Hi!
> So, did you get that feature working yet?
Nope. I thought you were going to ask on StackOverflow.
Or did you want me to?
>> Yeah, I'm aski
有没有办法在 Go 中做到这一点?
谢谢 :)