goland dlv在远程linux里运行代码开发,并debug调适

一、配置好ssh自动同步代码

参考下面连接:
https://www.cnblogs.com/haima/p/13257524.html

二、配置devbug监听运行

GO Remote
image

填写配置
image

linux上运行监听服务
注意:
每次监听时,debug只能断点一次,下次再使用时要重新运行下面的监听服务

image
如:上图有两种方式

  1. 直接运行代码并监听
dlv debug --headless --listen=:12345 --api-version=2 --accept-multiclien

image

  1. 编辑成二进制文件,再运行代码并监听
go build -gcflags "all=-N -l"  -o main

dlv --listen=:12345 --headless=true --api-version=2 --accept-multiclient exec ./main

image

运行debug
image

posted @ 2023-09-17 10:47  HaimaBlog  阅读(190)  评论(0编辑  收藏  举报