go env -w GOPROXY=https://goproxy.cn,direct
git clone https://github.com/derekparker/delve.git
cd delve/cmd/dlv/
go build
go install

之后cd到安装目录

cd $GOPATH/go/bin

运行下列命令进行监听

dlv debug --headless --listen=:2345 --api-version=2 --accept-multiclient