Browse Source

Revert "Fix parsing return values for zero parts, and allow zero when len(part) == 1"

This reverts commit fd83e1645f.
master
GeertJohan 10 years ago
parent
commit
2d60a9d54d
1 changed files with 1 additions and 7 deletions
  1. +1
    -7
      version.go

+ 1
- 7
version.go View File

@@ -64,10 +64,7 @@ func parseVersion(s string) (Version, bool) {
return InvalidVersion, false
}
for i, part := range parts {
if len(part) == 0 {
return InvalidVersion, false
}
if len(part) > 1 && part[0] == '0' {
if len(part) == 0 || part[0] == '0' {
return InvalidVersion, false
}
num, err := strconv.ParseInt(part, 10, 32)
@@ -87,8 +84,5 @@ func parseVersion(s string) (Version, bool) {
}
}

if v == InvalidVersion {
return InvalidVersion, false
}
return v, true
}

Loading…
Cancel
Save