Browse Source

build: parse go version at go tip

This parses go version when build is running
in moast recent go master branch.
Gyu-Ho Lee 10 years ago
parent
commit
0473cb93ac
1 changed files with 10 additions and 3 deletions
  1. 10 3
      build

+ 10 - 3
build

@@ -14,11 +14,18 @@ eval $(go env)
 GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"`
 GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"`
 
 
 val=$(go version)
 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="="
 	LINK_OPERATOR="="
 else
 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
 fi
 
 
 # Static compilation is useful when etcd is run in a container
 # Static compilation is useful when etcd is run in a container