This repository has been archived on 2022-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
dex/env
2016-05-06 13:31:09 -07:00

37 lines
1.1 KiB
Text

MAJOR_GOVERSION=$( go version | grep -o 'go1\.[0-9]')
FULL_GOVERSION=$( go version| grep -o 'go1\.[0-9|\.]*' )
# The list of unsupported major go versions.
UNSUPPORTED=( "go1.0" "go1.1" "go1.2" "go1.3" "go1.4" )
# Minor go verisons which have known security vulnerabilities. Refuse to build with these.
KNOWN_INSECURE=( "go1.5" "go1.5.1" "go1.5.2" )
for V in "${UNSUPPORTED[@]}"; do
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
echo "Go version ${V} has known security vulnerabilities which impact dex. Please update your Go verison."
exit 2
fi
done
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
export GO15VENDOREXPERIMENT=1
export VERSION=$(./git-version)
LD_FLAGS="-X main.version=${VERSION}"