2016-12-22 18:59:04 +05:30
|
|
|
#!/bin/bash
|
2016-12-14 01:30:36 +05:30
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
VERSION=$( go version )
|
|
|
|
|
|
|
|
# For development versions of Go, these will be empty.
|
|
|
|
MAJOR_GOVERSION=$( echo -n "$VERSION" | grep -o 'go1\.[0-9]' || true )
|
|
|
|
FULL_GOVERSION=$( echo -n "$VERSION" | grep -o 'go1\.[0-9|\.]*' || true )
|
|
|
|
|
|
|
|
# The list of unsupported major go versions.
|
2017-11-09 00:57:32 +05:30
|
|
|
UNSUPPORTED=( "go1.0" "go1.1" "go1.2" "go1.3" "go1.4" "go1.5" "go1.6" "go1.7" )
|
2016-12-14 01:30:36 +05:30
|
|
|
|
2017-03-20 21:46:56 +05:30
|
|
|
# Minor go versions which have known security vulnerabilities. Refuse to build with these.
|
2016-12-14 01:30:36 +05:30
|
|
|
#
|
2017-11-09 00:57:32 +05:30
|
|
|
# There aren't any security issues that impact dex in current Go versions but minor versions
|
|
|
|
# should be added here later if they do have issues.
|
2016-12-14 01:30:36 +05:30
|
|
|
KNOWN_INSECURE=( )
|
|
|
|
|
|
|
|
for V in "${UNSUPPORTED[@]}"; do
|
|
|
|
if [ "$V" = "$MAJOR_GOVERSION" ]; then
|
2017-11-09 00:57:32 +05:30
|
|
|
>&2 echo "ERROR: dex requires Go version 1.8+. Please update your Go installation: https://golang.org/dl/"
|
2016-12-14 01:30:36 +05:30
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for V in "${KNOWN_INSECURE[@]}"; do
|
|
|
|
if [ "$V" = "$FULL_GOVERSION" ]; then
|
2017-03-20 21:46:56 +05:30
|
|
|
>&2 echo "Go version ${V} has known security vulnerabilities which impact dex. Please update your Go version."
|
2016-12-14 01:30:36 +05:30
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|