From 03048fbb730ba6fee6094000ace446c4f78fa064 Mon Sep 17 00:00:00 2001 From: Tom Benner Date: Sun, 13 Dec 2015 22:11:52 -0800 Subject: [PATCH] Prevent 'Invalid Version' when Go patch number is missing --- build/gocommand.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build/gocommand.js b/build/gocommand.js index d6127a586..e5c694f4b 100644 --- a/build/gocommand.js +++ b/build/gocommand.js @@ -98,10 +98,15 @@ function checkGoVersion() { deferred.reject(new Error('Go version not found.')); return; } - if (semver.lt(match[0], minGoVersion)) { + let currentGoVersion = match[0]; + // semver requires a patch number, so we'll append '.0' if it isn't present. + if (currentGoVersion.split('.').length === 2) { + currentGoVersion = `${currentGoVersion}.0`; + } + if (semver.lt(currentGoVersion, minGoVersion)) { deferred.reject( new Error( - `The current go version "${match[0]}" is older than ` + + `The current go version "${currentGoVersion}" is older than ` + `the minimum required version "${minGoVersion}". ` + `Please upgrade your go version!`)); return; -- GitLab