func toSemVerRange()

in validators/package_validator_linux.go [250:270]


func toSemVerRange(input string) string {
	var output []string
	fields := strings.Fields(input)
	for _, f := range fields {
		numDots, hasDigits := 0, false
		for _, c := range f {
			switch {
			case c == '.':
				numDots++
			case c >= '0' && c <= '9':
				hasDigits = true
			}
		}
		if hasDigits && numDots < semVerDotsCount {
			f = strings.TrimRight(f, " ")
			f += ".x"
		}
		output = append(output, f)
	}
	return strings.Join(output, " ")
}