From a09143f1f865ab224103362ada1fab42e4a259c8 Mon Sep 17 00:00:00 2001 From: Rich Knight <548432+rcknight@users.noreply.github.com> Date: Tue, 14 Apr 2020 10:45:10 +0100 Subject: [PATCH] Fix major version check There is existing functionality which is supposed to allow you to specify a major version e.g `nvm install 9` and have it install the latest v9. This was just checking the length of version is 1, which means `nvm install 10` installs `10.0.0`. I've changed this to check if the string contains no `.`, which (I think?) is a more reasonable approach which will work for future versions. --- src/nvm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvm.go b/src/nvm.go index a6699c7..c2e664b 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -192,7 +192,7 @@ func install(version string, cpuarch string) { // if the user specifies only the major version number then install the latest // version of the major version number - if len(version) == 1 { + if !strings.Contains(version, ".") { version = findLatestSubVersion(version) } else { version = cleanVersion(version)