网站备案 几年,室内装饰设计师证书有用吗,维启网站建设,网站制作新手1 先在远程服务器安装golang和delve golang的安装#xff0c;通过官网直接下载安装包安装接口
go install github.com/go-delve/delve/cmd/dlvlatest 如果dlv和golang版本不匹配#xff0c;这里把latest换成匹配的版本#xff0c;比如1.20.0 2 编译带调试信息的程序
go bu…1 先在远程服务器安装golang和delve golang的安装通过官网直接下载安装包安装接口
go install github.com/go-delve/delve/cmd/dlvlatest 如果dlv和golang版本不匹配这里把latest换成匹配的版本比如1.20.0 2 编译带调试信息的程序
go build -gcflags all-N -l
这里go.mod文件在同级目录下比如编译出的程序名为Test.exe 3 在远程机器上运行程序
dlv --listen:2345 --headlesstrue --api-version2 --accept-multiclient --log exec ./Test.exe -- -d
这里我的程序运行需要传递命令行参数 -d 4 本机配置launch.json并运行
{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid830387version: 0.2.0,configurations: [{name: Remote Debug,type: go,request: attach,mode: remote,//remotePath: D:\\Test,port: 2345, host: 10.10.0.37, cwd: ${workspaceFolder} }]
}
这里因为是直接调试exe远程机器上并没有部署源代码不需要remotePath这一项配置完launch.json后直接F5运行在相关位置下断点即可。