From 0473cb93acec880b1396e5f2fdeb150329b0406e Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Fri, 4 Dec 2015 11:37:01 -0800 Subject: [PATCH] build: parse go version at go tip This parses go version when build is running in moast recent go master branch. --- build | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build b/build index b6e2877ab2b..7aea4c14aef 100755 --- a/build +++ b/build @@ -14,11 +14,18 @@ eval $(go env) GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"` val=$(go version) -ver=$(echo $val | awk -F ' ' '{print $3}' | awk -F '.' '{print $2}') -if [ $ver -gt 4 ]; then +# if 'go version' contains string 'devel', it assumes the go tip branch, +# which is greater than go 1.5+. +if [[ $val == *"devel"* ]] +then LINK_OPERATOR="=" else - LINK_OPERATOR=" " + ver=$(echo $val | awk -F ' ' '{print $3}' | awk -F '.' '{print $2}') + if [ $ver -gt 4 ]; then + LINK_OPERATOR="=" + else + LINK_OPERATOR=" " + fi fi # Static compilation is useful when etcd is run in a container