我需要关于链码实例化的帮助,它依赖于其他go包,如golang/protobuf和pkg/error。下面是我在对等日志中得到的错误,
2018-01-10 19:59:42.040 UTC [endorser] simulateProposal -> ERRO 405 failed to invoke chaincode name:"lscc" on transaction 380f014688cb8638b66cc9e9c8c85f1bf06ba062fbb979442483f7e9ae2139be, error: Error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/Loyalty/loyalty.go:15:2: cannot find package "github.com/golang/protobuf/proto" in any of:
/opt/go/src/github.com/golang/protobuf/proto (from $GOROOT)
/chaincode/input/src/github.com/golang/protobuf/proto (from $GOPATH)
/opt/gopath/src/github.com/golang/protobuf/proto
chaincode/input/src/Loyalty/loyalty.go:18:2: cannot find package "github.com/pkg/errors" in any of:
/opt/go/src/github.com/pkg/errors (from $GOROOT)
/chaincode/input/src/github.com/pkg/errors (from $GOPATH)
/opt/gopath/src/github.com/pkg/errors
我已经将它们挂载到对等docker上,并出现在这些/opt/gopath/src/github.com/golang/protobuf/proto
位置
发布于 2018-08-30 15:03:12
为了编译链码,对等节点使用fabric-ccenv
基础镜像启动新的容器。因此,挂载到对等文件夹的/opt/gopath/src/github.com/golang/protobuf/proto
在运行时不可用。
最好提供带有链码的proto
包,尝试在项目的根文件夹中运行以下命令:
govendor add github.com/golang/protobuf/proto
此命令应创建子文件夹vendor/github.com/golang/protobuf/proto
,并在其中填充所有必要的文件。只需再次尝试安装您的链代码,所需的依赖项将随源代码一起提供,并在运行时可用。
https://stackoverflow.com/questions/48195557
复制