Goland—远程Debug

Introduce

主要是本地不能调试的代码,通过Goland远程断点调试

步骤

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1. 安装Go
curl https://github.com/Piwriw/k8s_example_tools/blob/master/setup-packages/go/setup-linux.sh -o setup-go.sh
sh setup-go.sh 1.19


2. 安装dlv
go install github.com/go-delve/delve/cmd/dlv@latest

3. 安装gcc
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH
yum install -y gcc
apt install -y gcc

4. 远程服务器启动dlv