diff --git a/buildscripts/checkdeps.sh b/buildscripts/checkdeps.sh index eeee0adb..1d7e11b2 100755 --- a/buildscripts/checkdeps.sh +++ b/buildscripts/checkdeps.sh @@ -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 diff --git a/runtime-checks.go b/runtime-checks.go index 4d069652..2aada2d4 100644 --- a/runtime-checks.go +++ b/runtime-checks.go @@ -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) }