doumeng9188
2018-08-25 17:46
浏览 97
已采纳

传递参数时如何在调试器中运行Go二进制文件?

I have a precompiled Go binary called abc which I run like this ./abc import --src_type=redis --src_uri="redis://localhost:6379/0" redis-test

I also want to print a few values in certain packages of this application for debugging purposes. How do I run this binary with the arguments in a debugger?

图片转代码服务由CSDN问答提供 功能建议

我有一个预编译的Go二进制文件abc,它像这样运行。/abc import --src_type = redis --src_uri =“ redis:// localhost:6379/0” redis-test

我也想在此应用程序的某些程序包中打印一些值以进行调试 目的。 如何在调试器中使用参数运行二进制文件?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dousendun8411 2018-08-25 18:54
    已采纳

    I assume dlv is already installed? If not, it's a simple go get, see https://github.com/derekparker/delve

    dlv exec ./abc -- import --src_type=redis --src_uri="redis://localhost:6379/0" redis-test 
    

    -- in the debugger means take the rest as arguments to the program being run

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题