Add support of golang tip (#1756)

This commit is contained in:
Anis Elleuch
2016-07-09 07:36:22 -07:00
committed by Harshavardhana
parent 7a21e4bb0d
commit fc448e49d5
2 changed files with 19 additions and 6 deletions
+9 -4
View File
@@ -53,8 +53,8 @@ readlink() {
###
#
# Takes two arguments
# arg1: version number in `x.x.x` format
# arg2: version number in `x.x.x` format
# arg1: version number in `x.x.x` format or `devel`
# arg2: version number in `x.x.x` format or `devel`
#
# example: check_version "$version1" "$version2"
#
@@ -85,8 +85,13 @@ check_version() {
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if [ "$ver1" = "devel" ]; then
return 1
fi
if [ "$ver2" = "devel" ]; then
return 2
fi
if ((10#${ver1[i]} > 10#${ver2[i]})); then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]})); then
@@ -186,7 +191,7 @@ is_supported_arch() {
}
check_deps() {
check_version "$(env go version 2>/dev/null | sed 's/^.* go\([0-9.]*\).*$/\1/')" "${GO_VERSION}"
check_version "$(env go version 2>/dev/null | sed 's/^.* \(devel\|go[0-9.]*\).*$/\1/' | sed 's/go\([0-9.]*\)$/\1/')" "${GO_VERSION}"
if [ $? -ge 2 ]; then
MISSING="${MISSING} golang(>=${GO_VERSION})"
fi
+10 -2
View File
@@ -19,6 +19,7 @@ package main
import (
"fmt"
"runtime"
"strings"
"github.com/hashicorp/go-version"
"github.com/minio/mc/pkg/console"
@@ -26,8 +27,15 @@ import (
// check if minimum Go version is met.
func checkGoVersion() {
// Current version.
curVersion, e := version.NewVersion(runtime.Version()[2:])
runtimeVersion := runtime.Version()
// Checking version is always successful with go tip
if strings.HasPrefix(runtimeVersion, "devel") {
return
}
// Parsing golang version
curVersion, e := version.NewVersion(runtimeVersion[2:])
if e != nil {
console.Fatalln("Unable to determine current go version.", e)
}