-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merging latest tag v2.0.1 into master
- Loading branch information
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
#set -x | ||
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
error_exit () { | ||
>&2 echo "${1}" | ||
if [[ $# -gt 1 ]] | ||
then | ||
exit ${2} | ||
else | ||
exit 1 | ||
fi | ||
} | ||
|
||
copy_tools () { | ||
if [[ -z "$GOPATH" ]]; then | ||
error_exit "GOPATH env var should be set..." | ||
fi | ||
for tool in $@; do | ||
tool="${tool%%/...*}" | ||
if [[ ! -x $GOPATH/bin/${tool##*/} ]]; then | ||
echo "$GOPATH/bin/${tool##*/} doesn't exist. We copy it from build tools folder to $GOPATH/bin" | ||
arch=$(uname -m) | ||
if [[ ! -d ${scriptDir}/tools/${arch} ]]; then | ||
error_exit "No binaries found for arch:${arch}" | ||
fi | ||
cp ${scriptDir}/tools/${arch}/${tool##*/} $GOPATH/bin | ||
fi | ||
done | ||
} | ||
|
||
go get -u -v $@ | ||
if [[ $? -ne 0 ]]; then | ||
echo "go get command failed for tools building : we'll use saved binaries instead." | ||
copy_tools $@ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters