Documentation
¶
Index ¶
- Variables
- type SemVer
- func (s SemVer) Compare(b SemVer) int
- func (s SemVer) Equal(b SemVer) bool
- func (s SemVer) HigherThan(b SemVer) bool
- func (s SemVer) IsInvalid() bool
- func (s SemVer) IsValid() bool
- func (s SemVer) MajorString() string
- func (s *SemVer) SetMajorMinorOnly()
- func (s *SemVer) SetMajorOnly()
- func (s SemVer) String() string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type SemVer ¶
type SemVer struct {
Major uint16
Minor uint16
Patch uint16
HasMinor bool
HasPatch bool
Valid bool
Prefix byte
Suffix string
}
func NewEmptySemVer ¶
func NewEmptySemVer() SemVer
NewEmptySemVer returns a zeroed SemVer with minor and patch components marked as present.
func ParseSemVer ¶
ParseSemVer parses input into a SemVer. An optional v prefix is accepted and a suffix is only allowed when allowSuffix is true.
func (SemVer) Compare ¶
Compare compares semantic-version precedence. Prefixes, missing zero components and build metadata do not affect precedence.
func (SemVer) HigherThan ¶
HigherThan reports whether s has higher precedence than b.
func (SemVer) IsInvalid ¶ added in v1.0.3
IsInvalid reports whether s does not represent a successfully parsed or constructed version.
func (SemVer) IsValid ¶ added in v1.0.3
IsValid reports whether s was produced by a successful parse or constructor.
func (SemVer) MajorString ¶ added in v1.0.1
MajorString returns the major component, with the v prefix when present and no minor or patch components.
func (*SemVer) SetMajorMinorOnly ¶ added in v1.0.1
func (s *SemVer) SetMajorMinorOnly()
SetMajorMinorOnly truncates the version to its major and minor components, clearing patch and suffix.
func (*SemVer) SetMajorOnly ¶ added in v1.0.1
func (s *SemVer) SetMajorOnly()
SetMajorOnly truncates the version to its major component, clearing minor, patch and suffix.