对fabric官方文档提供的fabcar实例进行改写时,试图中加一行 import "github.com/Myproject"
报错:
Error: Error getting chaincode code chaincode: Error getting chaincode package bytes: Error obtaining dependencies for github.com/Myproject: <go, [list -f {{ join .Deps "\n"}} github.com/Myproject]>: failed with error: "exit status 1"
can't load package: package github.com/fentec-project: cannot find package "github.com/Myproject" in any of:
/opt/go/src/github.com/Myproject (from $GOROOT)
/opt/gopath/src/github.com/Myproject (from $GOPATH)
解决方案
1.打开docker-compose.yml
cli配置部分注意docker和本地的共享路径设置!
这里我将原来的- ./../chaincode/:/opt/gopath/src/github.com/改为了/Users/qin/go/src/github.com/:/opt/gopath/src/github.com/
另外,打开startFabric.sh文件
peer chaincode install这一句也要相应做修改cli peer chaincode install -n cpabe -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/mytestcode