shared/version/version.go
func NewDottedVersion(versionString string) (*DottedVersion, error) {
	formatError := fmt.Errorf("Invalid version format: %s", versionString)
	split := strings.Split(versionString, ".")
	if len(split) < 2 {
		return nil, formatError
	}

	maj, err := strconv.Atoi(split[0])
	if err != nil {
		return nil, formatError
	}

	min, err := strconv.Atoi(split[1])
	if err != nil {
		return nil, formatError
	}

	patch := -1
	if len(split) == 3 {
		patch, err = strconv.Atoi(split[2])
		if err != nil {
			return nil, formatError
		}
	}

	return &DottedVersion{
		Major: maj,
		Minor: min,
		Patch: patch,
	}, nil
}
func NewDottedVersion(versionString string) (*DottedVersion, error) {
	formatError := fmt.Errorf("Invalid version format: %s", versionString)
	split := strings.Split(versionString, ".")
	if len(split) < 2 {
		return nil, formatError
	}

	maj, err := strconv.Atoi(split[0])
	if err != nil {
		return nil, formatError
	}

	min, err := strconv.Atoi(split[1])
	if err != nil {
		return nil, formatError
	}

	patch := -1
	if len(split) == 3 {
		patch, err = strconv.Atoi(split[2])
		if err != nil {
			return nil, formatError
		}
	}

	return &DottedVersion{
		Major: maj,
		Minor: min,
		Patch: patch,
	}, nil
}
// NewDottedVersion returns a new Version.