系统相关
首页 > 系统相关> > ubuntu 下 go 语言调试器 dlv 的安装

ubuntu 下 go 语言调试器 dlv 的安装

作者:互联网

1.  从 https://github.com/derekparker/delve.git 下载delve压缩包delve-master.zip。

2. 使用 winscp 工具将delve-master.zip 远程到 linux机器里面。

3. 解压压缩包:unzip delve-master.zip

4. 复制压缩包到指定的路径下,否则编译会出错:cp -r ./delve-master /root/go/src/github.com/go-delve/delve/

5. 进入路径下面:cd /root/go/src/github.com/go-delve/delve/

6. 修改go.mod:

module github.com/go-delve/delve

require (
github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561
github.com/mattn/go-isatty v0.0.3
github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b
github.com/pkg/profile v0.0.0-20170413231811-06b906832ed0
github.com/russross/blackfriday v0.0.0-20180428102519-11635eb403ff // indirect
github.com/sirupsen/logrus v0.0.0-20180523074243-ea8897e79973
github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372
github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1 // indirect
golang.org/x/arch v0.0.0-20171004143515-077ac972c2e4
golang.org/x/crypto v0.0.0-20180614174826-fd5f17ee7299 // indirect
golang.org/x/sys v0.0.0-20180614134839-8883426083c0
golang.org/x/tools v0.0.0-20181120060634-fc4f04983f62
gopkg.in/yaml.v2 v2.0.0-20170407172122-cd8b52f8269e
)
replace ( golang.org/x/arch v0.0.0-20171004143515-077ac972c2e4 => github.com/golang/arch v0.0.0-20171004143515-077ac972c2e4
| golang.org/x/crypto v0.0.0-20180614174826-fd5f17ee7299 => github.com/golang/crypto v0.0.0-20180614174826-fd5f17ee7299
| golang.org/x/sys v0.0.0-20180614134839-8883426083c0 => github.com/golang/sys v0.0.0-20180614134839-8883426083c0
)

replace后面的语句为追加语句

7. 编译:

cd ./cmd/dlv/

go build

8. 将命令拷贝到path 路径的任意一个目录下:

 

cp ./dlv /usr/local/bin/

 

9 测试命令:

 

 说明工具安装完成。

 

标签:github,v0.0,golang,dlv,ubuntu,go,delve,com,调试器
来源: https://www.cnblogs.com/20170722-kong/p/10644487.html