const numbers … const alphas … const alphanum … var SpecVersion … type Version … // Version to string func (v Version) String() string { … } // FinalizeVersion discards prerelease and build number and only returns // major, minor and patch number. func (v Version) FinalizeVersion() string { … } // Equals checks if v is equal to o. func (v Version) Equals(o Version) bool { … } // EQ checks if v is equal to o. func (v Version) EQ(o Version) bool { … } // NE checks if v is not equal to o. func (v Version) NE(o Version) bool { … } // GT checks if v is greater than o. func (v Version) GT(o Version) bool { … } // GTE checks if v is greater than or equal to o. func (v Version) GTE(o Version) bool { … } // GE checks if v is greater than or equal to o. func (v Version) GE(o Version) bool { … } // LT checks if v is less than o. func (v Version) LT(o Version) bool { … } // LTE checks if v is less than or equal to o. func (v Version) LTE(o Version) bool { … } // LE checks if v is less than or equal to o. func (v Version) LE(o Version) bool { … } // Compare compares Versions v to o: // -1 == v is less than o // 0 == v is equal to o // 1 == v is greater than o func (v Version) Compare(o Version) int { … } // IncrementPatch increments the patch version func (v *Version) IncrementPatch() error { … } // IncrementMinor increments the minor version func (v *Version) IncrementMinor() error { … } // IncrementMajor increments the major version func (v *Version) IncrementMajor() error { … } // Validate validates v and returns error in case func (v Version) Validate() error { … } // New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error func New(s string) (*Version, error) { … } // Make is an alias for Parse, parses version string and returns a validated Version or error func Make(s string) (Version, error) { … } // ParseTolerant allows for certain version specifications that do not strictly adhere to semver // specs to be parsed by this library. It does so by normalizing versions before passing them to // Parse(). It currently trims spaces, removes a "v" prefix, adds a 0 patch number to versions // with only major and minor components specified, and removes leading 0s. func ParseTolerant(s string) (Version, error) { … } // Parse parses version string and returns a validated Version or error func Parse(s string) (Version, error) { … } // MustParse is like Parse but panics if the version cannot be parsed. func MustParse(s string) Version { … } type PRVersion … // NewPRVersion creates a new valid prerelease version func NewPRVersion(s string) (PRVersion, error) { … } // IsNumeric checks if prerelease-version is numeric func (v PRVersion) IsNumeric() bool { … } // Compare compares two PreRelease Versions v and o: // -1 == v is less than o // 0 == v is equal to o // 1 == v is greater than o func (v PRVersion) Compare(o PRVersion) int { … } // PreRelease version to string func (v PRVersion) String() string { … } func containsOnly(s string, set string) bool { … } func hasLeadingZeroes(s string) bool { … } // NewBuildVersion creates a new valid build version func NewBuildVersion(s string) (string, error) { … } // FinalizeVersion returns the major, minor and patch number only and discards // prerelease and build number. func FinalizeVersion(s string) (string, error) { … }