drbl91357 2018-07-09 07:44
浏览 211

将外部程序包添加到Hyperledger Fabric -go smartcontract

I am trying to add an external package to my go smartcontract (for installation , I ran : go get github.com/stripe/stripe-go) . I then imported files stripe "github.com/stripe/stripe-go" and charge "github.com/stripe/stripe-go/charge" , in my smartcontract (https://github.com/stripe/stripe-go). However, when I try to bring up my chaincode , I am getting the error :

Error: Error getting chaincode code chaincode: Error getting chaincode package bytes: Error obtaining dependencies for github.com/stripe/stripe-go: : failed with error: "exit status 1" can't load package: package github.com/stripe/stripe-go: cannot find package "github.com/stripe/stripe-go" in any of: /opt/go/src/github.com/stripe/stripe-go (from $GOROOT) /opt/gopath/src/github.com/stripe/stripe-go (from $GOPATH)

I tried adding the package through govendor (http://hyperledger-fabric.readthedocs.io/en/release-1.0/Style-guides/go-style.html) , but that also is not working .

Request you all to please hep me on this . Thanks in advance.

  • 写回答

1条回答 默认 最新

  • doutusheng5879 2018-07-09 08:49
    关注

    I had the similar issue. Govendor worked for me:

    error getting chaincode package bytes: Error obtaining dependencies for github.com/go-ozzo/ozzo-validation/is

    govendor add github.com/go-ozzo/ozzo-validation/is
    govendor update +v
    go build
    

    And result was good:

    Chaincode is installed on remote peer PEER2

    UPDATE:

    If you have a problem with vendor packages setup, here you go:

    1. create folder vendor in project root directory with empty valid json file (vendor.json)
    2. run command govendor add +external from root directory
    3. you can also update all dependencies with update command.
    评论

报告相同问题?

悬赏问题

  • ¥15 使用yolov5-7.0目标检测报错
  • ¥15 对于这个问题的解释说明
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备