func parseVersion(name, version, build string) (VSphereVersion, error) {
	v := VSphereVersion{
		Product: name,
	}
	s := strings.Split(version, ".")
	if len(s) > 3 {
		return v, fmt.Errorf("version string %q has more than 3 components", version)
	}
	var err error
	v.Major, err = strconv.Atoi(s[0])
	if err != nil {
		return v, fmt.Errorf("could not parse major version %q from version string %q", s[0], version)
	}
	v.Minor, err = strconv.Atoi(s[1])
	if err != nil {
		return v, fmt.Errorf("could not parse minor version %q from version string %q", s[1], version)
	}
	v.Patch, err = strconv.Atoi(s[2])
	if err != nil {
		return v, fmt.Errorf("could not parse patch version %q from version string %q", s[2], version)
	}
	v.Build, err = strconv.Atoi(build)
	if err != nil {
		return v, fmt.Errorf("could not parse build version string %q", build)
	}

	return v, nil
}
func parseVersion(name, version, build string) (VSphereVersion, error) {
	v := VSphereVersion{
		Product: name,
	}
	s := strings.Split(version, ".")
	if len(s) > 3 {
		return v, fmt.Errorf("version string %q has more than 3 components", version)
	}
	var err error
	v.Major, err = strconv.Atoi(s[0])
	if err != nil {
		return v, fmt.Errorf("could not parse major version %q from version string %q", s[0], version)
	}
	v.Minor, err = strconv.Atoi(s[1])
	if err != nil {
		return v, fmt.Errorf("could not parse minor version %q from version string %q", s[1], version)
	}
	v.Patch, err = strconv.Atoi(s[2])
	if err != nil {
		return v, fmt.Errorf("could not parse patch version %q from version string %q", s[2], version)
	}
	v.Build, err = strconv.Atoi(build)
	if err != nil {
		return v, fmt.Errorf("could not parse build version string %q", build)
	}

	return v, nil
}
func parseVersion ( name , version , build string ) ( VSphereVersion , error ) { v := VSphereVersion { Product : name , } s := strings . Split ( version , " " ) if len ( s ) > 3 { return v , fmt . Errorf ( " " , version ) } var err error v . Major , err = strconv . Atoi ( s [ 0 ] ) if err != nil { return v , fmt . Errorf ( " " , s [ 0 ] , version ) } v . Minor , err = strconv . Atoi ( s [ 1 ] ) if err != nil { return v , fmt . Errorf ( " " , s [ 1 ] , version ) } v . Patch , err = strconv . Atoi ( s [ 2 ] ) if err != nil { return v , fmt . Errorf ( " " , s [ 2 ] , version ) } v . Build , err = strconv . Atoi ( build ) if err != nil { return v , fmt . Errorf ( " " , build ) } return v , nil }
// parseVersion creates a new VSphereVersion from a parsed version string and
// build number.
parseVersion creates a new VSphereVersion from a parsed version string and build number .