diff --git a/proc/go_version.go b/proc/go_version.go index 88a89b96..895f5ac1 100644 --- a/proc/go_version.go +++ b/proc/go_version.go @@ -33,11 +33,14 @@ func parseVersionString(ver string) (GoVersion, bool) { vr = strings.SplitN(v[1], "rc", 2) if len(vr) == 2 { r.RC, err3 = strconv.Atoi(vr[1]) + } else { + r.Minor, err2 = strconv.Atoi(v[1]) + if err2 != nil { + return GoVersion{}, false + } + return r, true } } - if len(vr) < 2 { - return GoVersion{}, false - } r.Minor, err2 = strconv.Atoi(vr[0]) r.Rev = -1 diff --git a/proc/proc_test.go b/proc/proc_test.go index 049d5cce..1feae022 100644 --- a/proc/proc_test.go +++ b/proc/proc_test.go @@ -668,6 +668,7 @@ func versionAfterOrEqual(t *testing.T, verStr string, ver GoVersion) { } func TestParseVersionString(t *testing.T) { + versionAfterOrEqual(t, "go1.4", GoVersion{1, 4, 0, 0, 0}) versionAfterOrEqual(t, "go1.5.0", GoVersion{1, 5, 0, 0, 0}) versionAfterOrEqual(t, "go1.4.2", GoVersion{1, 4, 2, 0, 0}) versionAfterOrEqual(t, "go1.5beta2", GoVersion{1, 5, -1, 2, 0})