From the spec, "Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes.". These segments can be dot separated.
(p string)
| 741 | // Numeric identifiers MUST NOT include leading zeroes.". These segments can |
| 742 | // be dot separated. |
| 743 | func validatePrerelease(p string) error { |
| 744 | eparts := strings.Split(p, ".") |
| 745 | for _, p := range eparts { |
| 746 | if p == "" { |
| 747 | return ErrInvalidPrerelease |
| 748 | } else if containsOnly(p, num) { |
| 749 | if len(p) > 1 && p[0] == '0' { |
| 750 | return ErrSegmentStartsZero |
| 751 | } |
| 752 | } else if !containsOnly(p, allowed) { |
| 753 | return ErrInvalidPrerelease |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | return nil |
| 758 | } |
| 759 | |
| 760 | // From the spec, "Build metadata MAY be denoted by |
| 761 | // appending a plus sign and a series of dot separated identifiers immediately |
searching dependent graphs…