介绍
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
解决方式:修改btcd项目目录下的glide.yaml 包中的 package: golang.org/x/crypto/ripemd160 为 package: golang.org/x/crypto
然后重新执行以下命令 进行更新安装
$ glide up
2.
问题:Unable to export dependencies to vendor directory: Error moving files: exit status 1
解决方案:
对文件 $GOPATH\src\github.com\Masterminds\glide\path\winbug.go 做如下修改:
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
有疑问加站长微信联系(非本文作者)