Documentation ¶
Overview ¶
Package semver provides functionality to parse and process semantic versions, as they are used in multiple components of Constellation.
The official semantic versioning specification disallows leading "v" prefixes. However, the Constellation config uses the "v" prefix for versions to make version strings more recognizable. This package bridges the gap between Go's semver pkg (doesn't allow "v" prefix) and the Constellation config (requires "v" prefix).
Index ¶
- func Sort(list []Semver)
- func ToStrings(in []Semver) []string
- type Semver
- func (v Semver) Compare(other Semver) int
- func (v Semver) IsUpgradeTo(other Semver) error
- func (v Semver) Major() int
- func (v Semver) MajorMinorEqual(other Semver) bool
- func (v Semver) MarshalJSON() ([]byte, error)
- func (v Semver) MarshalYAML() (any, error)
- func (v Semver) Minor() int
- func (v Semver) NextMinor() string
- func (v Semver) Patch() int
- func (v Semver) Prerelease() string
- func (v Semver) String() string
- func (v *Semver) UnmarshalJSON(data []byte) error
- func (v *Semver) UnmarshalYAML(unmarshal func(any) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Semver ¶
type Semver struct {
// contains filtered or unexported fields
}
Semver represents a semantic version.
func NewFromInt ¶ added in v2.10.0
NewFromInt constructs a new Semver from three integers and prerelease string: MAJOR.MINOR.PATCH-PRERELEASE.
func (Semver) Compare ¶
Compare compares two versions. It relies on the semver.Compare function internally. The result will be 0 if v == w, -1 if v < w, or +1 if v > w.
func (Semver) IsUpgradeTo ¶
IsUpgradeTo returns if a version is an upgrade to another version. It checks if the version of v is greater than the version of other and allows a drift of at most one minor version.
func (Semver) MajorMinorEqual ¶ added in v2.9.0
MajorMinorEqual returns if the major and minor version of two versions are equal.
func (Semver) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Semver) MarshalYAML ¶ added in v2.10.0
MarshalYAML implements the yaml.Marshaller interface.
func (Semver) Prerelease ¶ added in v2.7.0
Prerelease returns the prerelease section of the object.
func (*Semver) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.