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

传递参数时如何在调试器中运行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?

  • 写回答

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

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

报告相同问题?