0
点赞
收藏
分享

微信扫一扫

【中间件】Redis从入门到精通-黑马点评综合实战

奔跑的酆 2024-08-12 阅读 25

配置代理

go env -w GO111MODULE=on

go env -w GOPROXY=https://goproxy.cn,direct

vscode 调试debug

/usr/local/go/bin/go install -v github.com/go-delve/delve/cmd/dlv@latest

/usr/local/go/bin/go install -v golang.org/x/tools/gopls@latest

调试需要root权限

debug如果需要root模式,比如ebpf需要root权限,尝试了"asRoot": true没有效果,选择vscode使用root用户名ssh远程登陆主机,解决。

调试脚本

vscode 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/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceFolder}",
            // "args": ["raw" , "-f", "my_func@1@2", "-e","tcp and port 80", "-t", "-nnve","-p", "59162"],
            "args": [
                "raw",
                "-f",
                "my_func@1@2",
                "-p",
                "59162"
            ],
            // "console": "integratedTerminal",
            "asRoot": true,
            "buildFlags": ["-buildvcs=false"]
        }
    ]
}

buildvcs构建参数问题

Starting: /root/go/bin/dlv dap --listen=127.0.0.1:33071 --log-dest=3 from /home/ken/Codes/go_work/netcap
DAP server listening at: 127.0.0.1:33071
Build Error: go build -o /home/ken/Codes/go_work/netcap/__debug_bin40809128 -gcflags all=-N -l .
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping. (exit status 1)

在launch.json中加入 “buildFlags”: [“-buildvcs=false”]。

举报

相关推荐

0 条评论