Documentation
¶
Index ¶
- Variables
- func ResolveTag(repo, tag string, prerelease bool, getter HTTPGetter) (string, error)
- func SetVerbose(enabled bool, writer io.Writer)
- func TagFamilyLatest(repo, prefix string, getter HTTPGetter) (string, bool)
- func VerboseEnabledForTest() bool
- type AssetFinder
- func (f *AssetFinder) AssetMetadata(url string) (id, size int64, updatedAt time.Time, digest string, ok bool)
- func (f *AssetFinder) Find() ([]string, error)
- func (f *AssetFinder) FindMatch() ([]string, error)
- func (f *AssetFinder) ReleasePublishedAt() time.Time
- func (f *AssetFinder) ReleaseVersion() string
- type Error
- type Finder
- type HTTPGetter
- type HTTPGetterFunc
- type Release
- type ResolvedRelease
- type SourceFinder
Constants ¶
This section is empty.
Variables ¶
var ErrNoUpgrade = errors.New("requested release is not more recent than current version")
Functions ¶
func ResolveTag ¶ added in v1.13.0
func ResolveTag(repo, tag string, prerelease bool, getter HTTPGetter) (string, error)
ResolveTag resolves a tag, or a tag pattern, to a concrete release tag. An empty tag resolves the repository's latest release and a pattern resolves the newest matching release, so callers such as `query` accept the same tag grammar as an install without selecting an asset.
func SetVerbose ¶
func TagFamilyLatest ¶ added in v1.15.2
func TagFamilyLatest(repo, prefix string, getter HTTPGetter) (string, bool)
TagFamilyLatest reports the version-maximum tag among the repository's refs that share the literal prefix, via the matching-refs endpoint (one small response even for monorepos that publish hundreds of releases).
ok=false means the family cannot be ordered conclusively — endpoint failure, no matching refs, ambiguous tags or a tie — and the caller must fall back to the release scan instead of assuming the family is exhausted.
func VerboseEnabledForTest ¶
func VerboseEnabledForTest() bool
Types ¶
type AssetFinder ¶
type AssetFinder struct {
Repo string
Tag string
Prerelease bool
MinTime time.Time
Getter HTTPGetter
// contains filtered or unexported fields
}
func NewAssetFinder ¶
func NewAssetFinder(repo, tag string, prerelease bool, minTime time.Time) *AssetFinder
func (*AssetFinder) AssetMetadata ¶ added in v1.8.8
func (*AssetFinder) Find ¶
func (f *AssetFinder) Find() ([]string, error)
func (*AssetFinder) FindMatch ¶
func (f *AssetFinder) FindMatch() ([]string, error)
FindMatch scans releases newest-first and returns the first whose tag satisfies the filter. Unlike a plain substring match, a bare filter anchors at the tag prefix so it cannot select an unrelated product's release inside a monorepo.
A stable tag is preferred. When only prerelease tags match — common when a monorepo marks each product release prerelease so the repository-wide Latest pointer does not jump between products — the newest prerelease is used.
func (*AssetFinder) ReleasePublishedAt ¶ added in v1.15.2
func (f *AssetFinder) ReleasePublishedAt() time.Time
ReleasePublishedAt reports when the resolved release was published, falling back to its creation time when the API did not list a publish time.
func (*AssetFinder) ReleaseVersion ¶ added in v1.7.3
func (f *AssetFinder) ReleaseVersion() string
type HTTPGetterFunc ¶ added in v1.13.0
HTTPGetterFunc adapts a plain function to HTTPGetter.
type Release ¶
type Release struct {
Assets []releaseAsset `json:"assets"`
Prerelease bool `json:"prerelease"`
Tag string `json:"tag_name"`
CreatedAt time.Time `json:"created_at"`
// PublishedAt is the release publish time when the API returns one; a
// drafted release lists created_at only.
PublishedAt time.Time `json:"published_at"`
}
type ResolvedRelease ¶ added in v1.15.2
ResolvedRelease is a release picked by tag resolution: the concrete tag and when it was published.
func ResolveRelease ¶ added in v1.15.2
func ResolveRelease(repo, tag string, prerelease bool, getter HTTPGetter) (ResolvedRelease, error)
ResolveRelease resolves a tag, or a tag pattern, to a concrete release and also reports when the matched release was published (falling back to the release creation time when GitHub does not list a publish time).
type SourceFinder ¶
func NewSourceFinder ¶
func NewSourceFinder(repo, tag, tool string) *SourceFinder
func (*SourceFinder) Find ¶
func (f *SourceFinder) Find() ([]string, error)