系统相关
首页 > 系统相关> > Ubuntu 系统安装 go 调试工具 delve

Ubuntu 系统安装 go 调试工具 delve

作者:互联网

安装 go

1. 下载 go 二进制

go1.14.1.linux-amd64.tar.gz:
https://golang.google.cn/dl/go1.14.1.linux-amd64.tar.gz

tar -zxvf go1.14.1.linux-amd64.tar.gz
lhx@lhx-ubuntu:~/go/bin$ ls
go  gofmt
lhx@lhx-ubuntu:~/go/bin$ ./go version
go version go1.14.1 linux/amd64

2. 配置 go 环境变量

export GOPATH=/home/lhx/gopath

GOPATH="/home/lhx/gopath"
GOROOT="/home/lhx/go"

安装 delve

git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve

网速慢的话,可以从 gitcode 镜像下载:

git clone https://gitcode.net/mirrors/derekparker/delve.git $GOPATH/src/github.com/go-delve/delve
lhx@lhx-ubuntu:~$ cd $GOPATH/src/github.com/go-delve/delve
lhx@lhx-ubuntu:~/gopath/src/github.com/go-delve/delve$ make install
go: downloading github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372
go: downloading github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1
go install "-ldflags=-X main.Build=237c5026f40e38d2dd6f62a7362de7b25b00c1c7" github.com/go-delve/delve/cmd/dlv
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: downloading gopkg.in/yaml.v2 v2.2.1
go: downloading github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b
go: downloading github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5
go: downloading go.starlark.net v0.0.0-20190702223751-32f345186213
go: downloading golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb
go: downloading github.com/google/go-dap v0.2.0
go: downloading github.com/mattn/go-isatty v0.0.3
go: downloading golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4
go: downloading github.com/russross/blackfriday v1.5.2
go: downloading github.com/hashicorp/golang-lru v0.5.4
lhx@lhx-ubuntu:~/gopath/src/github.com/go-delve/delve$ cd $GOPATH
lhx@lhx-ubuntu:~/gopath$ ls
bin  pkg  src
lhx@lhx-ubuntu:~/gopath$ cd bin/
lhx@lhx-ubuntu:~/gopath/bin$ ls
dlv
lhx@lhx-ubuntu:~/gopath/bin$ ./dlv version
Delve Debugger
Version: 1.4.0
Build: 237c5026f40e38d2dd6f62a7362de7b25b00c1c7

标签:github,downloading,Ubuntu,go,delve,com,lhx
来源: https://www.cnblogs.com/liuhanxu/p/16057117.html