etcd/build
Jonathan Boulle 491362f5db scripts: add build, cover and update test
This adds a build script that attempts to be as user friendly as
possible: if they have already set $GOPATH and/or $GOBIN, use those
environment variables. If not, create a gopath for them in this
directory. This should facilitate both `go get` and `git clone` usage.

The `test` script is updated, and the new `cover` script facilitates
easy coverage generation for the repo's constituent packages by setting
the PKG environment variable.
2014-09-08 23:09:49 -07:00

25 lines
504 B
Bash
Executable File

#!/bin/bash -e
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/etcd"
# If the user hasn't set up a GOPATH, make one for them
if [[ -z "$GOPATH" ]]; then
GOPATH=${PWD}/gopath
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
# Similarly, set up GOBIN if not already set
if [[ -z "$GOBIN" ]]; then
GOBIN=${PWD}/bin
fi
fi
export GOPATH=$GOPATH
export GOBIN=$GOBIN
eval $(go env)
go install ${REPO_PATH}