Documentation
¶
Overview ¶
Package version resolves the latest allowed upstream version for a vendored Git source: it lists remote tags, parses semantic versions, and applies the configured version constraints.
Index ¶
- func ExtractGitURI(source string) string
- func FilterBySemverConstraint(versions []string, constraint string) ([]string, error)
- func FilterExcludedVersions(versions, excluded []string) []string
- func FilterPrereleases(versions []string) []string
- func FindLatestSemVerTag(tags []string) (*semver.Version, string)
- func IsGitSource(source string) bool
- func IsTemplatedVersion(version string) bool
- func IsValidCommitSHA(ref string) bool
- func MatchesWildcard(version, pattern string) bool
- func ParseSemVer(version string) (*semver.Version, error)
- func ResolveVersionConstraints(availableVersions []string, constraints *schema.VendorConstraints) (string, error)
- func SelectLatestVersion(versions []string) (string, error)
- type GoGitLister
- type RemoteLister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractGitURI ¶
ExtractGitURI extracts a clean Git URI from a vendor source string. It handles `git::` prefixes, `github.com/` shorthand, query parameters, and `.git` suffixes so the result can be handed to a remote lister.
func FilterBySemverConstraint ¶
FilterBySemverConstraint keeps only versions matching the semver constraint.
func FilterExcludedVersions ¶
FilterExcludedVersions removes versions matching any exclusion pattern.
func FilterPrereleases ¶
FilterPrereleases removes pre-release versions; non-semver values are kept.
func FindLatestSemVerTag ¶
FindLatestSemVerTag returns the highest semantic version among tags and the original tag string for it. Non-semver tags are ignored.
func IsGitSource ¶
IsGitSource reports whether a vendor source string looks like a Git repository (the only source type supported by update/diff in the initial version).
func IsTemplatedVersion ¶
IsTemplatedVersion reports whether a version string contains Go template syntax (e.g. `{{.Version}}`) and therefore must be skipped by update.
func IsValidCommitSHA ¶
IsValidCommitSHA reports whether ref looks like a Git commit SHA (7-40 hex chars).
func MatchesWildcard ¶
MatchesWildcard reports whether version matches pattern, which may be an exact value or a trailing-wildcard prefix such as "1.5.*".
func ParseSemVer ¶
ParseSemVer parses a version string as a semantic version, tolerating a leading `v`/`V` prefix.
func ResolveVersionConstraints ¶
func ResolveVersionConstraints(availableVersions []string, constraints *schema.VendorConstraints) (string, error)
ResolveVersionConstraints applies the configured constraints to a list of available versions and returns the latest version that satisfies them all.
func SelectLatestVersion ¶
SelectLatestVersion returns the highest semver value from versions, falling back to the first entry when none parse as semver.
Types ¶
type GoGitLister ¶
type GoGitLister struct{}
GoGitLister lists remote tags using go-git's in-memory remote (no shelling out to the `git` binary, no working tree). Public repositories work without auth; private repositories are out of scope for the initial version.
type RemoteLister ¶
RemoteLister lists tag names from a remote Git repository. It is an interface so update logic can be unit-tested without network access.
var DefaultLister RemoteLister = &GoGitLister{}
DefaultLister is the production RemoteLister backed by go-git.