这个过程描述得非常好here。 不幸的是,当我尝试在我的链码中导入msp包(github.com/hyperledger/fabric/protos/msp)时,我在安装阶段收到错误:
Error: Error getting chaincode code chaincode: Error getting chaincode package bytes: Error obtaining dependencies for github.com/hyperledger/fabric/protos/msp: <go, [list -f {{ join .Deps "\n"}} github.com/hyperledger/fabric/protos/msp]>: failed with error: "exit status 1"
can't load package: package github.com/hyperledger/fabric/protos/msp: cannot find package "github.com/hyperledger/fabric/protos/msp" in any of:
/opt/go/src/github.com/hyperledger/fabric/protos/msp (from $GOROOT)
/opt/gopath/src/github.com/hyperledger/fabric/protos/msp (from $GOPATH)
问:这是否意味着我可以在链码中使用有限的预定义导入集?
我正在使用dockerhub(1.0.2)上提供的最新光纤对接器图像来安装带有以下命令的cc:
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode install -n testcc -v 1.0 -p github.com/testcc
编辑:Artem是对的,错误来自安装命令 - 我已经更新了说明。
答案 0 :(得分:1)
首先,我认为您遇到的错误发生在安装阶段而不是实例化,因为它似乎是编译错误:
错误:获取链代码链代码时出错:获取链代码包字节时出错:获取github.com/hyperledger/fabric/protos/msp的依赖项时出错::失败并显示错误:“退出状态1”
无法加载包:github.com/hyperledger/fabric/protos/msp:无法找到包“github.com/hyperledger/fabric/protos/msp”中的任何一个:
/opt/go/src/github.com/hyperledger/fabric/protos/msp(来自$ GOROOT) /opt/gopath/src/github.com/hyperledger/fabric/protos/msp(来自$ GOPATH)
为了解决这个问题,您需要将缺少的软件包提供给您的链代码,例如:
govendor init
和
govendor fetch github.com/hyperledger/fabric/protos/msp
您很可能还需要提供其他依赖项。