func ParseVersion(vs string) (Version, error) {
	i := strings.IndexByte(vs, '-')
	if i >= 0 {
		vs = vs[:i]
	}
	cstrs := strings.Split(vs, ".")
	v := make(Version, len(cstrs))
	for i, cstr := range cstrs {
		cn, err := strconv.Atoi(cstr)
		if err != nil {
			return nil, fmt.Errorf("could not parse version string: %q is not an integer", cstr)
		}
		if cn < 0 {
			return nil, fmt.Errorf("could not parse version string: %q is negative", cstr)
		}
		v[i] = cn
	}
	return v, nil
}
func ParseVersion(vs string) (Version, error) {
	i := strings.IndexByte(vs, '-')
	if i >= 0 {
		vs = vs[:i]
	}
	cstrs := strings.Split(vs, ".")
	v := make(Version, len(cstrs))
	for i, cstr := range cstrs {
		cn, err := strconv.Atoi(cstr)
		if err != nil {
			return nil, fmt.Errorf("could not parse version string: %q is not an integer", cstr)
		}
		if cn < 0 {
			return nil, fmt.Errorf("could not parse version string: %q is negative", cstr)
		}
		v[i] = cn
	}
	return v, nil
}
func ParseVersion ( vs string ) ( Version , error ) { i := strings . IndexByte ( vs , '-' ) if i >= 0 { vs = vs [ : i ] } cstrs := strings . Split ( vs , " " ) v := make ( Version , len ( cstrs ) ) for i , cstr := range cstrs { cn , err := strconv . Atoi ( cstr ) if err != nil { return nil , fmt . Errorf ( " " , cstr ) } if cn < 0 { return nil , fmt . Errorf ( " " , cstr ) } v [ i ] = cn } return v , nil }
// ParseVersion parses a version of the form "12.34.56-abcd". Non-negative
// integer components are separated by dots. An arbitrary suffix may appear
// after '-', which is ignored.
ParseVersion parses a version of the form 12 . 34 . 56 - abcd . Non - negative integer components are separated by dots . An arbitrary suffix may appear after - which is ignored .