安装delve:
$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve
$ cd $GOPATH/src/github.com/go-delve/delve
$ make install
调试main包中代码
dlv debug github.com/me/foo/cmd/foo -- -arg1 value ##参数
子命令:
debug
test
help 查看更多帮助信息
core
run
exec
reply
trace
log
backend
dap
core
connect
attach
调试指令:
运行命令:
call
continue
next
restart
rev
rewind
step
step-instruction
step-out
中断管理:
break
breakpoints
clear
clearall
condition
on
trace
查看变量和内存:
args