100- dlv 断点调试
dlv 调试
dlv安装
$ go install github.com/go-delve/delve/cmd/dlv@latest
流程
debug 根据包名进行测试
1, 打断点
2, 请求
3, c 执行
curl http://127.0.0.1:8080/rand
查看端口
lsof -i:8080
kill 44
设置
(dlv) config max-string-len 999
(dlv) config -list
构建包
go build -gcflags 'gcflags="all=-N -l "' main.go
web
nohup ./main &
dlv attach 176
普通
//编译标识注意 -N -l ,禁止编译优化
go build -gcflags '-N -l' test.go
dlv exec test
Type 'help' for list of commands.
(dlv)