code: func ParseVersion(version string) (ver Version, err error) {
  	if version == "" {
  		return
  	}
  
  	parts := strings.SplitN(version, ".", 4)
  	if len(parts) < 2 || len(parts) > 4 {
  		err = errors.New(fmt.Sprintf(
  			"Version is not in form major.minor(.bugfix.prerelease) (got: %v)",
  			version))
  		return
  	}
  
  	var major, minor, bugfix, prerelease int
  	if major, err = parse(parts[0], version, "major"); err != nil {
  		return
  	}
  	if minor, err = parse(parts[1], version, "minor"); err != nil {
  		return
  	}
  
  	if len(parts) > 2 {
  		if bugfix, err = parse(parts[2], version, "bugfix"); err != nil {
  			return
  		}
  
  		if len(parts) > 3 {
  			if prerelease, err = parse(parts[3], version, "prerelease"); err != nil {
  				return
  			}
  			if prerelease == 0 {
  				err = errors.New(fmt.Sprintf(
  					"Invalid value %v for prerelease; should be 1 or 2 (got: %v)",
  					prerelease, version))
  				return
  			}
  		}
  	}
  
  	return newVersion(major, minor, bugfix, prerelease), nil
  }
docs: /*
  Parse a version number of the form major.minor.bugfix.prerlease
  
  Part .bugfix and part .prerelease are optional.
  Note that this is forwards compatible: the parsed version does not
  have to exist as a constant.
  */