Documentation
¶
Index ¶
- func Build() string
- func DepVersion(modulePath string) string
- func Equal(v string) bool
- func GoVersion() string
- func GreaterThan(v string) bool
- func GreaterThanEqual(v string) bool
- func IsUnversioned() bool
- func IsValid() bool
- func LatestVersion(versions []string) string
- func LessThan(v string) bool
- func LessThanEqual(v string) bool
- func Prerelease() string
- func RepoVersions(owner, name, versionType string) ([]string, error)
- func Update(latest string) bool
- func VCSCommit() string
- func Version() string
- func Versions() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build() string
Build returns the build metadata value of the version if any. The '+' prefix is stripped.
func DepVersion ¶
DepVersion returns the version of a given dependency used. If the given dependency was not used, an empty string is returned. This does not guarantee a semver compliant response.
func GoVersion ¶
func GoVersion() string
GoVersion returns the golang version that was used to build the application. This does not guarantee a semver compliant response.
func GreaterThan ¶
GreaterThan returns true if the application version is greater than v.
func GreaterThanEqual ¶
GreaterThanEqual returns true if the application version is greater than or equal to version v.
func IsUnversioned ¶
func IsUnversioned() bool
IsUnversioned returns true if the version is the default unversioned string. This is likely to be true in development builds.
func IsValid ¶
func IsValid() bool
IsValid returns true if the version is in a state that is compatible with this package. This can be used to prevent invalid versions from being set.
func LatestVersion ¶
LatestVersion determines the latest version that is valid semver and not prerelease from a given set of version strings. If no string provided fits this criteria, an empty string is returned. There is no requirement for the versions to be sorted prior to calling. Can be used in conjunction with Versions and RepoVersions.
func LessThanEqual ¶
LessThanEqual returns true if the application version is less than or equal to version v.
func Prerelease ¶
func Prerelease() string
Prerelease returns the prerelease value of the version if any. The '-' prefix is stripped.
func RepoVersions ¶
RepoVersions fetches all of the releases/tags from the GitHub repository with the owner and name provided and reports back all the semver compliant tag names coupled with them. This only errors if the release or tag list could not be fetched.
func Update ¶
Update checks if the current application's version is lower than that of the version provided (only if the provided version is semver compliant). If the application's version is lower, Update will return true. If the application's version is equal to or greater than the given version, Update will return false. If the given version is not semver compliant, Update will return false.
func VCSCommit ¶
func VCSCommit() string
VCSCommit returns the version control system commit associated with the application's binary.
Types ¶
This section is empty.