由于Fabric 1.1与1.0的软件包问题,我的Hyperledger Fabirc无法使用Go构建

问题描述 投票:-1回答:1

现在,我正在关注本教程https://github.com/chainHero/heroes-service

[设置好.goyamltoml脚本后,dep ensure,然后go build

我得到错误

# github.com/chainHero/heroes-service/vendor/github.com/zmap/zlint/lints
vendor/github.com/zmap/zlint/lints/result.go:75:9: undefined: strings.ReplaceAll
# github.com/chainHero/heroes-service/vendor/github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util
vendor/github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util/csp.go:47:8: cannot convert nil to type csr.KeyRequest
vendor/github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util/csp.go:132:37: cannot use req.KeyRequest (type *csr.KeyRequest) as type csr.KeyRequest in argument to getBCCSPKeyOpts

我听说这是由于1.01.1的版本问题所致,后者是我的。我认为这将得到解决,因为在Gopkg.toml

# github.com/chainHero/heroes-service/vendor/github.com/zmap/zlint/lints
vendor/github.com/zmap/zlint/lints/result.go:75:9: undefined: strings.ReplaceAll
# github.com/chainHero/heroes-service/vendor/github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util
vendor/github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util/csp.go:47:8: cannot convert nil to type csr.KeyRequest
vendor/github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util/csp.go:132:37: cannot use req.KeyRequest (type *csr.KeyRequest) as type csr.KeyRequest in argument to getBCCSPKeyOpts

我仍然需要导入Go软件包吗?

更新:

我安装了Go 1.13.1,现在当我获得go build

build github.com/chainHero/heroes-service: cannot load github.com/hyperledger/fabric-sdk-go/pkg/client/msp: open /home/luke/go/src/github.com/hyperledger/fabric-sdk-go/pkg/client/msp: no such file or directory

我想这与在这里使用Fabric 1.0有关...

go hyperledger-fabric hyperledger
1个回答
1
投票

由于您的错误,Fabric v1.1似乎使用了go标准库中的strings.ReplaceAll,而您安装的Go版本不支持它。

根据strings.ReplaceAll的文档,它是在go版本1.12中添加的,因此您应该使用go版本> = 1.12

© www.soinside.com 2019 - 2024. All rights reserved.