utils/meta.go
func ParseVersion(v *version.Info) (ServerVersion, error) {
	var ret ServerVersion
	var err error
	ret.Major, err = strconv.Atoi(v.Major)
	if err != nil {
		// Try to parse using GitVersion
		return parseGitVersion(v.GitVersion)
	}

	// trim "+" in minor version (happened on GKE)
	v.Minor = strings.TrimSuffix(v.Minor, "+")
	ret.Minor, err = strconv.Atoi(v.Minor)
	if err != nil {
		// Try to parse using GitVersion
		return parseGitVersion(v.GitVersion)
	}
	return ret, err
}
func ParseVersion(v *version.Info) (ServerVersion, error) {
	var ret ServerVersion
	var err error
	ret.Major, err = strconv.Atoi(v.Major)
	if err != nil {
		// Try to parse using GitVersion
		return parseGitVersion(v.GitVersion)
	}

	// trim "+" in minor version (happened on GKE)
	v.Minor = strings.TrimSuffix(v.Minor, "+")
	ret.Minor, err = strconv.Atoi(v.Minor)
	if err != nil {
		// Try to parse using GitVersion
		return parseGitVersion(v.GitVersion)
	}
	return ret, err
}
func ParseVersion ( v * version . Info ) ( ServerVersion , error ) { var ret ServerVersion var err error ret . Major , err = strconv . Atoi ( v . Major ) if err != nil { // Try to parse using GitVersion return parseGitVersion ( v . GitVersion ) } // trim "+" in minor version (happened on GKE) v . Minor = strings . TrimSuffix ( v . Minor , " " ) ret . Minor , err = strconv . Atoi ( v . Minor ) if err != nil { // Try to parse using GitVersion return parseGitVersion ( v . GitVersion ) } return ret , err }
// ParseVersion parses version.Info into a ServerVersion struct
ParseVersion parses version . Info into a ServerVersion struct