mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

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.
25 lines
504 B
Bash
Executable File
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}
|