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

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

报告相同问题?

悬赏问题

  • ¥15 luckysheet
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误