INNER CODE UNIT · Go

MinorOfVersion

kubesphere/kubekey · builtin/core/upgrade_path.go:368

func MinorOfVersion(s string) (int, error) {
	s = strings.TrimPrefix(s, "v")
	parts := strings.SplitN(s, ".", 3)
	if len(parts) < 2 {
		return 0, fmt.Errorf("not a major.minor version: %q", s)
	}
	minorStr := strings.Map(func(r rune) rune {
		if r >= '0' && r <= '9' {
			return r
		}
		return -1
	}, parts[1])
	if minorStr == "" {
		return 0, fmt.Errorf("invalid minor in %q", s)
	}
	return strconv.Atoi(minorStr)
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…