Documentation ¶
Overview ¶
Package version provides version related functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compatible ¶
Compatible returns true if the two versions are compatible.
func GreaterThan ¶
GreaterThan returns true if the first version is greater than the second version.
func GreaterThanOrEqual ¶
GreaterThanOrEqual returns true if the first version is greater than or equal to the second version.
func IsValidVersionString ¶
IsValidVersionString returns true if the version string is valid.
func LessThanOrEqual ¶
LessThanOrEqual returns true if the first version is less than or equal to the second version.
Types ¶
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version is a version number. The version number is split into three parts: the major version, the minor version, and the patch version. The major version is incremented when a backwards incompatible change is made. The minor version is incremented when a backwards compatible change is made. The patch version is incremented when a bug fix is made. The version number is also split into a pre-release version and a stable version. The pre-release version is incremented when a pre-release version is made. The pre-release version is only used for pre-release versions. The stable version is only used for stable versions. The pre-release version is only used when the version is not a stable version.
func New ¶
func New( major int, minor int, patch int, preReleaseName string, preReleaseNumber int) (Version, error)
New creates a new version. If the version is stable, the pre-release name should be empty and the pre-release number should -1.
func NewFromString ¶
NewFromString creates a new version from a version string.
func (Version) PreReleaseName ¶
PreReleaseName returns the pre-release name.
func (Version) PreReleaseNumber ¶
PreReleaseNumber returns the pre-release number.