duanlongling5308 2019-01-21 02:52 采纳率: 0%
浏览 416
已采纳

Golang在调试时不接受标准输入

When debugging with Goland on macos, my program waits for input from stdin.

I can type in the console and press enter, but the input is not passed to my program.

It is just like typing in a text editor. I can type, press enter, delete everything I just did. My program gets none of this passed to it.

I also get this behavior when debugging with dlv from the console, however, I have found discussion on how to address it in that circumstance:

https://github.com/go-delve/delve/issues/1274#issuecomment-406969034

I see a similar fix for vscode as well:

https://github.com/Microsoft/vscode-go/issues/219#issuecomment-192164367

But I could not find a solution for goland.

  • 写回答

1条回答 默认 最新

  • dongshang1934 2019-01-21 06:20
    关注

    This is a known issue, see the official issue tracker report for this.

    The workaround for it is to compile the application with the correct debugging flags, -gcflags="all=-N -l" for Go 1.10 or newer and -gcflags="-N -l" for Go 1.9 or older), launch the application in an OS terminal and then use the Attach to process... feature. You can also see the linked issue to see other possible workarounds.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么