normalizeConstraint adds '-0' to version expressions that don't contain a prerelease identifier See https://github.com/Masterminds/semver#working-with-prerelease-versions
(constraint string)
| 585 | // normalizeConstraint adds '-0' to version expressions that don't contain a prerelease identifier |
| 586 | // See https://github.com/Masterminds/semver#working-with-prerelease-versions |
| 587 | func normalizeConstraint(constraint string) string { |
| 588 | // remove all commas, so we can split by spaces |
| 589 | constraintNoCommas := strings.ReplaceAll(constraint, ",", " ") |
| 590 | // Split the constraint into tokens based on spaces |
| 591 | tokens := strings.Fields(constraintNoCommas) |
| 592 | for i, token := range tokens { |
| 593 | last := token[len(token)-1] |
| 594 | // If the token represents a version number (ends with a digit or is a wildcard) |
| 595 | // and doesn't contain a suffix '-0', append '-0' |
| 596 | if !strings.HasSuffix(token, "-0") && strings.Contains("0123456789xX*", string(last)) { |
| 597 | tokens[i] = token + "-0" |
| 598 | } |
| 599 | } |
| 600 | return strings.Join(tokens, " ") |
| 601 | } |
no outgoing calls
no test coverage detected