MCPcopy Create free account
hub / github.com/Masterminds/semver / validateMetadata

Function validateMetadata

version.go:764–774  ·  view source on GitHub ↗

From the spec, "Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty."

(m string)

Source from the content-addressed store, hash-verified

762// following the patch or pre-release version. Identifiers MUST comprise only
763// ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty."
764func validateMetadata(m string) error {
765 eparts := strings.Split(m, ".")
766 for _, p := range eparts {
767 if p == "" {
768 return ErrInvalidMetadata
769 } else if !containsOnly(p, allowed) {
770 return ErrInvalidMetadata
771 }
772 }
773 return nil
774}
775
776// validateVersion checks for common validation issues but may not catch all errors
777func validateVersion(m []string) error {

Callers 6

TestValidateMetadataFunction · 0.85
StrictNewVersionFunction · 0.85
NewVersionFunction · 0.85
coerceNewVersionFunction · 0.85
SetMetadataMethod · 0.85
validateVersionFunction · 0.85

Calls 1

containsOnlyFunction · 0.85

Tested by 1

TestValidateMetadataFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…