storj/scripts/setup-gopath.sh
Egon Elbre 51ae3d6e72
Travis with go1.11 and modules (#479)
* Travis uses Go 1.11
* Use go modules instead of storj-vendor
* Automatic caching of downloaded dependencies
* Ensures that modules incompatible linters run with modules
2018-10-16 20:02:00 +03:00

33 lines
794 B
Bash

set -x
mkdir -p ~/bin ~/cache
export PATH=~/bin:$PATH
export GOSPACE_ROOT=$GOPATH
export GOSPACE_PKG=storj.io/storj
export GOSPACE_REPO=git@github.com:storj/storj/git
mkdir -p $GOPATH/src/storj.io
mv $GOPATH/src/github.com/storj/storj $GOPATH/src/storj.io
# setup gospace
wget -O ~/bin/gospace https://github.com/storj/gospace/releases/download/v0.0.1/gospace_linux_amd64
chmod +x ~/bin/gospace
# find module dependency hash
MODHASH=$(gospace hash)
# download dependencies, if we don't have them in cache
if [ ! -f $HOME/cache/$MODHASH.zip ]; then
gospace zip-vendor $HOME/cache/$MODHASH.zip
fi
# unpack the dependencies into gopath
gospace unzip-vendor $HOME/cache/$MODHASH.zip
gospace flatten-vendor
export TRAVIS_BUILD_DIR=$GOPATH/src/storj.io/storj
cd $TRAVIS_BUILD_DIR
set +x