2016-06-03 23:49:19 +05:30
|
|
|
# For development versions of Go, these will be empty.
|
|
|
|
MAJOR_GOVERSION=$( go version | grep -o 'go1\.[0-9]' || true)
|
|
|
|
FULL_GOVERSION=$( go version| grep -o 'go1\.[0-9|\.]*' || true)
|
2016-02-13 02:48:26 +05:30
|
|
|
|
2016-03-10 03:31:18 +05:30
|
|
|
# The list of unsupported major go versions.
|
2016-03-10 02:35:48 +05:30
|
|
|
UNSUPPORTED=( "go1.0" "go1.1" "go1.2" "go1.3" "go1.4" )
|
2016-02-13 02:48:26 +05:30
|
|
|
|
2016-03-10 03:31:18 +05:30
|
|
|
# Minor go verisons which have known security vulnerabilities. Refuse to build with these.
|
|
|
|
KNOWN_INSECURE=( "go1.5" "go1.5.1" "go1.5.2" )
|
|
|
|
|
2016-03-10 02:35:48 +05:30
|
|
|
for V in "${UNSUPPORTED[@]}"; do
|
2016-03-10 03:31:18 +05:30
|
|
|
if [ "$V" = "$MAJOR_GOVERSION" ]; then
|
|
|
|
echo "dex requires Go version 1.5.3+. Please update your Go version."
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for V in "${KNOWN_INSECURE[@]}"; do
|
|
|
|
if [ "$V" = "$FULL_GOVERSION" ]; then
|
2016-04-09 12:58:03 +05:30
|
|
|
echo "Go version ${V} has known security vulnerabilities which impact dex. Please update your Go verison."
|
2016-03-10 02:35:48 +05:30
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
2016-02-13 02:48:26 +05:30
|
|
|
|
2016-05-07 02:01:09 +05:30
|
|
|
PROJ="dex"
|
|
|
|
ORG_PATH="github.com/coreos"
|
|
|
|
REPO_PATH="${ORG_PATH}/${PROJ}"
|
|
|
|
|
|
|
|
if [ ! -h gopath/src/${REPO_PATH} ]; then
|
|
|
|
mkdir -p gopath/src/${ORG_PATH}
|
|
|
|
ln -s ${PWD} gopath/src/${REPO_PATH} || exit 255
|
|
|
|
fi
|
|
|
|
|
|
|
|
export GOPATH=${PWD}/gopath
|
|
|
|
export GOBIN=${PWD}/bin
|
2016-03-10 02:35:48 +05:30
|
|
|
export GO15VENDOREXPERIMENT=1
|
2016-03-03 01:33:13 +05:30
|
|
|
export VERSION=$(./git-version)
|
|
|
|
LD_FLAGS="-X main.version=${VERSION}"
|