Documentation
¶
Overview ¶
Package update provides auto-update mechanism for the agentpair binary.
Index ¶
Constants ¶
View Source
const ( // GitHubRepo is the repository for releases. GitHubRepo = "plexusone/agentpair" // ReleasesURL is the GitHub releases API endpoint. ReleasesURL = "https://api.github.com/repos/" + GitHubRepo + "/releases/latest" // CheckInterval is how often to check for updates. CheckInterval = 24 * time.Hour )
Variables ¶
View Source
var Version = "dev"
Version is the current version (set at build time).
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
}
Asset represents a release asset.
type CheckResult ¶
type CheckResult struct {
UpdateAvailable bool
CurrentVersion string
LatestVersion string
DownloadURL string
ReleaseNotes string
}
CheckResult contains the result of an update check.
type Release ¶
type Release struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
PublishedAt time.Time `json:"published_at"`
Assets []Asset `json:"assets"`
}
Release represents a GitHub release.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater handles checking and applying updates.
func (*Updater) Check ¶
func (u *Updater) Check(ctx context.Context) (*CheckResult, error)
Check checks for available updates.
func (*Updater) PrintUpdateNotice ¶
PrintUpdateNotice prints a notice if an update is available.
func (*Updater) ShouldCheck ¶
ShouldCheck returns true if enough time has passed since last check.
Click to show internal directories.
Click to hide internal directories.