dlv 远程调试

最后更新于:2022-04-02 02:52:19

[TOC] > [参考](https://www.jianshu.com/p/e74e940a64d9) ## 注意 要进行远程调试,需要 去掉 `-ldflags "-w -s"` 标签 ## 安装 delve [https://github.com/derekparker/delve](https://links.jianshu.com/go?to=https%3A%2F%2Fgithub.com%2Fderekparker%2Fdelve) ``` go get github.com/go-delve/delve/cmd/dlv ``` 执行文件在 `$GOPATH/bin` ## 添加debug 地址 ![UTOOLS1594376687148.png](http://yanxuan.nosdn.127.net/2f2e81f41e49d82e2d5b15acb9d48ad9.png) ## step3 远端 ``` dlv --listen=:2345 --headless=true --api-version=2 exec ./main ```
';