#!/bin/sh
rm -rf tidb
mkdir tidb
export GOPATH=`pwd`/tidb
#mkdir -p $GOPATH/src/github.com/pingcap/tidb
#git clone --depth 1 https://github.com/pingcap/tidb.git $GOPATH/src/github.com/pingcap/tidb
#go get -v -d github.com/pingcap/tidb/...
go get -v -d -u github.com/pingcap/tidb/...
go get -v -d -u github.com/pingcap/goyacc/...
go get -v -d -u github.com/qiuyesuifeng/golex/...
( cd $GOPATH/src/github.com/pingcap/tidb
  # go get -v -d -u ./...
  #export GO111MODULE=on
  #go mod vendor -v
)
chmod -R a+rw tidb
tar cf - --exclude .git tidb | xz -9 >tidb-`date '+%Y%m%d'`.tar.xz
rm -rf tidb
