Documentation ¶
Index ¶
- func Bump(version string, releaseType ReleaseType) (string, error)
- func Compare(left string, right string) (int, error)
- func Format(input string) (string, error)
- func FulfillsConstraint(version string, constraint string) bool
- func IsStable(input string) bool
- func IsValidSemver(input string) bool
- type ReleaseType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bump ¶
func Bump(version string, releaseType ReleaseType) (string, error)
Bump bumps a version component up by one. The releaseType parameter specifies the component to be bumped: ReleaseMajor bumps the major version number, ReleaseMinor bumps the minor version number, ReleasePatch bumps the patch version number. The returned string is the new version and the error is nil if bumping was successful.
func Compare ¶
Compare compares two versions. It returns: - 0 if both versions are equal - -1 if `left` version is older than `right` version - 1 if `left` version is newer than `right` version Note: `Compare` only compares the major, minor, and patch version numbers. It does not support comparison of build numbers or pre-release labels such as alpha, beta, etc.
func Format ¶
Format formats the version string into a Semantic Versioning (SemVer) string format. If the input string is not a valid version, an error is returned. The function returns the formatted version string without a v prefix.
func FulfillsConstraint ¶
FulfillsConstraint checks if the given `version` fulfills the `constraint`. It returns `true` if `version` satisfies the constraints specified in `constraint`, and `false` otherwise. `constraint` should be a string that follows the format described in the semver 2.0.0 specification. Example constraint strings: ">=1.2.3", "^1.2.3", "2.0.0".
func IsValidSemver ¶
IsValidSemver checks that the given input is a valid semver version
Types ¶
type ReleaseType ¶
type ReleaseType int32
const ( ReleaseNone ReleaseType = 0 ReleasePatch ReleaseType = 1 ReleaseMinor ReleaseType = 2 ReleaseMajor ReleaseType = 3 )
func HighestReleaseType ¶
func HighestReleaseType(numbers []ReleaseType) ReleaseType