我在 Go 中有一个 REPL 应用程序,它应该对键盘按下事件做出反应(每个按键按下的不同动作),但ReadString希望在阅读之前按下返回键os.Stdin:
import (
"bufio"
"os"
)
for {
reader := bufio.NewReader(os.Stdin)
key, _ := reader.ReadString('\n')
deferKey(key)
}
如何对 Go 中的按键事件做出反应?
哔哔one
翻阅古今
随时随地看视频慕课网APP
相关分类