This is a creation in Article, where the information may have evolved or changed.
Hyperledger Fabric Client SDK for Go
Go get-u github.com/hyperledger/fabric-sdk-go
Document Https://godoc.org/github.com/hyperledger/fabric-sdk-go
compatibility
- 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
Run the overall test CD $GOPATH/src/github.com/hyperledger/fabric-sdk-go/
Make Depend-install Some packages cannot go get to, only git clone
Make in the makefile file, perform the DEP ensure-vendor-only times wrong
The reason is that when the GODEP tool looks for the package source based on the name configuration in Gopkg.toml, the name and the GIT address of the package are inconsistent, such as Name:google.golang.org/grpc Git: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
Adding a source configuration is also invalid for issue tracking on GitHub https://github.com/golang/dep/issues/860 now remove "populate" in Makefile, do not deal with vendor problem, and use the dependency package under Gopath
Make Clean
Run part of the test
# in the Fabric SDK Go directory cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/# ensure dependencies is Installedmake depend# Running code checks (license, linting, spelling, etc)make checks# Running All unit testsmake Unit-test# Running All integration testsmake Integration-testThere is no good way to network problems that require multiple attemptsError:
The reason is that in the Docker compose file, when the directory is mapped, the local fabric-sdk-go directory is mapped to the Fabric-sdk-go directory of the container, and the dependency package is in the vendor package
manually copy the dependent packages under $gopath to the fabric-sdk-go/vendor Run again
Make Integration-test
Using Docker to open the Fabric network test environment
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
The tag of the local mirror does not match the requirements and requires manual modification of the mirrored 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)
< /span>