首页 > 解决方案 > Hyperledger Fabric 1.2.0 开发者链码教程无法获取和构建

问题描述

尝试遵循hyperledger fabric 1.2.0 开发者链码教程

我无法通过执行 go get -u github.com/hyperledger/fabric/core/chaincode/shim. 我尝试按照此处的建议hyperledger/fabric从我的 GOPATHsrc目录中删除源文件夹,但不断弹出相同的错误消息:

github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive
../github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:364:5: hdr.Format undefined (type *tar.Header has no field or method Format)
../github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:364:15: undefined: tar.FormatPAX
../github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:1166:7: hdr.Format undefined (type *tar.Header has no field or method Format)
../github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:1166:17: undefined: tar.FormatPAX

跳过go get命令并直接进入go build将输出与上述相同的错误。

我也尝试安装 gnu-tar无济于事。

标签: hyperledger-fabrichyperledger

解决方案


重新安装最新的稳定版 Golang 就可以解决问题。在撰写本文时,go 的稳定版本是 1.10.3。

该问题是由 golang 版本 1.9.3 具有未定义的结构引起的,tar.FormatPAX其中一个超级账本结构 go 源文件需要该结构。


推荐阅读