#!/bin/sh -x
rm -rf hyperledger-fabric
GOPATH="`pwd`/hyperledger-fabric"
export GOPATH
mkdir -p $GOPATH/src/github.com/hyperledger
git clone --depth 1 https://github.com/hyperledger/fabric.git $GOPATH/src/github.com/hyperledger/fabric
( cd $GOPATH/src/github.com/hyperledger/fabric
  go get -v -d
  # dep ensure
)
#go get -v -d -u github.com/hyperledger/fabric/...
tar cvf - --exclude .git hyperledger-fabric | xz -9 >hyperledger-fabric-`date '+%Y%m%d'`.tar.xz
rm -rf hyperledger-fabric
