@@ -869,21 +869,21 @@ var parseVersionRegex = regexp.MustCompile(`(?m)^[^\d]*(?P<major>\d+)\.(?P<minor
869
869
870
870
// ParseVersion extracts the major, minor, and optional patch number from a
871
871
// version string.
872
- func ParseVersion (version string ) (major , minor , patch int , err error ) {
872
+ func ParseVersion (version string ) (int , int , int , error ) {
873
873
names := parseVersionRegex .SubexpNames ()
874
874
matches := parseVersionRegex .FindStringSubmatch (version )
875
875
if len (matches ) == 0 {
876
- err = fmt .Errorf ("failed to parse version '%v'" , version )
877
- return
876
+ err : = fmt .Errorf ("failed to parse version '%v'" , version )
877
+ return 0 , 0 , 0 , err
878
878
}
879
879
880
880
data := map [string ]string {}
881
881
for i , match := range matches {
882
882
data [names [i ]] = match
883
883
}
884
- major , _ = strconv .Atoi (data ["major" ])
885
- minor , _ = strconv .Atoi (data ["minor" ])
886
- patch , _ = strconv .Atoi (data ["patch" ])
884
+ major , _ : = strconv .Atoi (data ["major" ])
885
+ minor , _ : = strconv .Atoi (data ["minor" ])
886
+ patch , _ : = strconv .Atoi (data ["patch" ])
887
887
return major , minor , patch , nil
888
888
}
889
889
0 commit comments