此过程在此处很好地描述了。不幸的是,当我尝试导入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)
Q:这是否意味着我可以在链代码中使用有限的预定义的导入集?
我正在使用Dockerhub(1.0.2)上可用的最新面料Docker图像,并使用以下命令安装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是对的,错误从install命令出现 - 我已经更新了描述。
首先,我认为您遇到的错误是在安装阶段而不是实例化的,因为这似乎是一个编译错误:
错误:错误获取链码代码链码:错误获取链代码软件包字节:错误获得github.com/hyperledger/fabric/fabric/protos/msp ::失败的错误:"退出状态1"
无法加载软件包:github.com/hyperledger/fabric/protos/msp:在任何一个:
中都找不到软件包" github.com/hyperledger/fabric/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
很可能您还需要供应其他依赖项。