Browse Source

Merge pull request #3958 from gyuho/build_gotip

build: parse go version at go tip
Xiang Li 10 years ago
parent
commit
b806e510a9
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