Fix: Support for x.y versions
This commit is contained in:
parent
f0f6fa6b2e
commit
77d46a51fb
@ -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])
|
||||
}
|
||||
}
|
||||
if len(vr) < 2 {
|
||||
} else {
|
||||
r.Minor, err2 = strconv.Atoi(v[1])
|
||||
if err2 != nil {
|
||||
return GoVersion{}, false
|
||||
}
|
||||
return r, true
|
||||
}
|
||||
}
|
||||
|
||||
r.Minor, err2 = strconv.Atoi(vr[0])
|
||||
r.Rev = -1
|
||||
|
||||
@ -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})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user