Hyperledger Fabric Client SDK for Go

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。

Hyperledger Fabric Client SDK for Go

go get -u github.com/hyperledger/fabric-sdk-go

文檔  https://godoc.org/github.com/hyperledger/fabric-sdk-go

相容性
  • fabric v1.0.1 & fabric-ca v1.0.1
    • fabric-sdk-go: master:HEAD
  • fabric v1.0.0 & fabric-ca v1.0.0
    • fabric-sdk-go: master:110bf21bf3ab0a9a084f46d9698e1daeeda68a59
運行整體測試cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/
make depend-install一些包無法go get到,只能git clone
make在Makefile檔案中,執行dep ensure -vendor-only時報錯

原因是godep工具根據Gopkg.toml中name配置尋找包源的時候,name和包的git地址不一致,譬如name: google.golang.org/grpcgit : https://github.com/grpc/grpc-go
name: golang.org/x/crypto
git  https://github.com/golang/crypto
name: golang.org/x/sync
git  https://github.com/golang/sync
name: golang.org/x/net
git: https://github.com/golang/net
添加source配置也無效,在github上的問題追蹤https://github.com/golang/dep/issues/860目前在Makefile中去掉"populate",不去處理vendor問題,而使用GOPATH下的依賴包
make clean 運行部分測試
# In the Fabric SDK Go directorycd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/# Ensure dependencies are installedmake depend# Running code checks (license, linting, spelling, etc)make checks# Running all unit testsmake unit-test# Running all integration testsmake integration-test沒有太好的辦法,網路問題,需要多次嘗試報錯:

原因是在docker compose檔案中,映射目錄時,將本地fabric-sdk-go目錄映射到容器的fabric-sdk-go目錄,依賴包採用的是vendor中包
手動將$GOPATH下的依賴包拷貝到fabric-sdk-go/vendor中再次運行
make integration-test

用docker開啟fabric網路測試環境

Testing with Local Build of Fabric (Advanced)

Alternatively you can build and run Fabric on your own box using the following commands:

# Build fabric:
cd $GOPATH/src/github.com/hyperledger/
git clone https://github.com/hyperledger/fabric
cd $GOPATH/src/github.com/hyperledger/fabric/
git checkout v1.0.1

make docker

本地鏡像的tag與要求不匹配,需要手動修改鏡像的tag REPOSITORY

docker tag imageId repository:tag


# Build fabric-ca:
cd $GOPATH/src/github.com/hyperledger/
git clone https://github.com/hyperledger/fabric-ca
cd $GOPATH/src/github.com/hyperledger/fabric-ca/
git checkout v1.0.1
make docker

# Start fabric - latest-env.sh overrides the default docker tags in .env
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/fixtures/
(source latest-env.sh && docker-compose up --force-recreate)



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.