dtvpl739577 2018-08-19 14:41
浏览 388

如何在Golang dlv中重新加载源文件

I am using dlv to debug golang source code. Is there any command that reloads a program after modifying the source code? I have searched online and the dlv documentation but did not found anything on how to do that.

Any help will be appreciated.

environment : centos

  • 写回答

2条回答 默认 最新

  • douxuanma4357 2018-08-20 01:28
    关注

    ~~ guess you are looking for live code reloading like this ~~

    ~~ https://github.com/codegangsta/gin ~~

    • 1 if you are looking to debug without exiting vim then: :new | 0read ! dlv debug # will do.

    • 2 if you are looking to load the dlv mode constantly you can probably use tmux with split-pane. With one pane having vim and your file open and the other running dlv. When you change your file in vim(in a pane) delve(in the companion pane) reloads this file for debugging.

    • 3 if you just want to run debug at the time of saving the file, prefix the first command with autocmd BufWritePre Filetype go and add that to your virmc.

    If you are looking for some command that rebuilds your executable each time you make a change, I think you are in the wrong place, debugging is not meant to rebuild the executable. After you are done debugging, you can check your application and run the command(some variation of go build or some wrapper that calls it). To build your executable.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向