现在,我正在关注本教程https://github.com/chainHero/heroes-service
设置.go
和yaml
和toml
脚本后,
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.0
与1.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有关...
答案 0 :(得分:1)
由于您的错误,Fabric v1.1似乎使用了go标准库中的strings.ReplaceAll
,而您安装的Go版本不支持它。
根据strings.ReplaceAll的文档,它是在go版本1.12中添加的,因此您应该使用go => 1.12的go版本