我是新来的,德尔夫和戈兰伊德。我想远程调试使用 make 在docker中运行(使用docker+docker-compose)。
make
我用来提出我的环境的命令是 make myproject
make myproject
我的终结点宿主在: localhost:8080
localhost:8080
在Goland中创建调试配置时,它指定在运行之前 dlv debug --headless --listen=:2345 --api-version 2 ,请执行以下操作:
dlv debug --headless --listen=:2345 --api-version 2
go build -gcflags='-N -l' github.com/myproject dlv --listen=:2345 --headless=true --api version=2 exec ./myproject
当我的项目在本地主机8080上运行时,是否有一种方法可以附加到它?如果是这样,这些命令会有什么不同?
提前谢谢
dlv debug --headless --listen=:2345 --api-version 2 your/package/name
go build -gcflags='-N -l' github.com/myproject dlv --listen=:2345 --headless=true --api version=2 exec ./myproject 向您展示您可以单独编译二进制文件,以防您需要更大的灵活性,然后启动调试器。请记住,添加 -gcflags='-N -l' -gcflags='all=-N -l'
-gcflags='-N -l'
-gcflags='all=-N -l'
Run|Attach to Process dlv --headless --listen=:2345 --api-version 2 attach <pid>
Run|Attach to Process
dlv --headless --listen=:2345 --api-version 2 attach <pid>
an article 几个月前,针对这个问题,请看一看,以获得更详细的答复。