#!/bin/sh
rm -rf dkron
mkdir dkron
cd dkron
export GOPATH=`pwd`
mkdir -p src/github.com/victorcoder
#go get -v -d github.com/victorcoder/dkron/...
git clone --depth 1 https://github.com/victorcoder/dkron.git src/github.com/victorcoder/dkron
( cd $GOPATH/src/github.com/victorcoder/dkron
  export GO111MODULE=on
  #go mod vendor -v
  #go mod download
  go get -v -d .
)
cd ..
#shtool subst -e 's;github\.com/kardianos/osext;bitbucket.org/kardianos/osext;g' \
#    dkron/src/bitbucket.org/kardianos/osext/osext.go
chmod -R a+rw dkron
#rm -rf dkron/pkg/mod/cache
tar -c -v -f- --exclude .git dkron | xz -9 >dkron-`date '+%Y%m%d'`.tar.xz
rm -rf dkron
