Documentation ¶
Overview ¶
Package versioncheck provides endpoints to retrieve version information via different providers and utilities to compare versions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoMatch = errors.New("no match")
)
var (
ErrNoTags = errors.New("no tags available")
)
Functions ¶
This section is empty.
Types ¶
type CompareType ¶
type CompareType int
CompareType specifies the type of comparison used for different semantic versions.
const ( Major CompareType = iota Minor Patch Exact )
type GitHubProvider ¶
type GitHubProvider struct {
// contains filtered or unexported fields
}
GitHubProvider implements Provider using a GitHub repositories tag list as source for the current version.
func NewGitHubProvider ¶
func NewGitHubProvider(owner, repo string) *GitHubProvider
NewGitHubProvider returns a new instance of GitHubProvider with the passed repository owner and name as source.
func (*GitHubProvider) GetLatestVersion ¶
func (gh *GitHubProvider) GetLatestVersion() (v Semver, err error)
type Semver ¶
type Semver struct { Major int `json:"major"` Minor int `json:"minor"` Patch int `json:"patch"` Attachment string `json:"attachment"` }
Semver represents the elements of a semantic version. See: https://semver.org/spec/v2.0.0.html
func ParseSemver ¶
ParseSemver takes a semantic version as string and tries to parse it into a Semver instance.
func (Semver) Equal ¶
func (v Semver) Equal(v2 Semver, et ...CompareType) (ok bool)
Equal returns true if the given semver equals the current semver down to the given compare type.
func (Semver) LaterThan ¶
func (v Semver) LaterThan(v2 Semver, et ...CompareType) (ok bool)
LaterThan returns true if the given semver is later than the current semver down to the given compare type.