介绍
bitcoin的go语言版本1.12
安装
下载地址:
https://github.com/btcsuite/btcd
执行以下命令:
$ go get -u github.com/Masterminds/glide
$ git clone https://github.com/btcsuite/btcd $GOPATH/src/github.com/btcsuite/btcd
$ cd $GOPATH/src/github.com/btcsuite/btcd
因为国内很多工具类无法下载,需要翻墙,或者修改源
$ rm -rf ~/.glide
$ mkdir -p ~/.glide
$ glide mirror set https://golang.org/x/mobile https://github.com/golang/mobile --vcs git
$ glide mirror set https://golang.org/x/crypto https://github.com/golang/crypto --vcs git
$ glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
$ glide mirror set https://golang.org/x/tools https://github.com/golang/tools --vcs git
$ glide mirror set https://golang.org/x/text https://github.com/golang/text --vcs git
$ glide mirror set https://golang.org/x/image https://github.com/golang/image --vcs git
$ glide mirror set https://golang.org/x/sys https://github.com/golang/sys --vcs git
安装依赖包
$ glide init
$ glide install
编译工程
$ go install . ./cmd/...
异常现象:
1.
问题:Update failed for golang.org/x/crypto/ripemd160: Cannot detect VCS
![](https://img.haomeiwen.com/i4853806/111240c6220d0c66.png)
解决方式:修改btcd项目目录下的glide.yaml 包中的 package: golang.org/x/crypto/ripemd160 为 package: golang.org/x/crypto
![](https://img.haomeiwen.com/i4853806/6b9b09abda534e8c.png)
然后重新执行以下命令 进行更新安装
$ glide up
2.
问题:Unable to export dependencies to vendor directory: Error moving files: exit status 1
![](https://img.haomeiwen.com/i4853806/da8e8d264fdc2962.png)
解决方案:
对文件 $GOPATH\src\github.com\Masterminds\glide\path\winbug.go 做如下修改:
![](https://img.haomeiwen.com/i4853806/5a8394c63cf2c26b.png)
cmd := exec.Command("cmd.exe", "/c", "xcopy /s/y", o, n+"\\")
然后 执行一下命令:
$ cd $GOPATH\src\github.com\Masterminds\glide
$ go build glide.go
$ cp glide $GOPATH\bin
重新打开命令窗口后执行以下命令
$ cd $GOPATH\src\github.com\btcsuite\btcd
$ glide up
![](https://img.haomeiwen.com/i4853806/39f23c1df7002841.png)
网友评论