Documentation
¶
Index ¶
- Constants
- func AssetCandidates(platform ReleasePlatform) []string
- func CompareVersions(v1, v2 string) int
- func GetDefaultCachePath() string
- func IsCacheFresh(cache *UpdateCache, ttl time.Duration) bool
- func NormalizeReleaseVersion(tag string) string
- func ReadCachedUpdateNotice(path string, currentVersion string) (string, bool)
- func ReleaseChannel(version string, prerelease bool) string
- func SpawnUpdateWorker(execPath string, args ...string) error
- func WriteCache(path string, cache *UpdateCache) error
- type GitHubAsset
- type GitHubRelease
- type ReleaseAsset
- type ReleaseCatalog
- type ReleaseCatalogEntry
- type ReleasePlatform
- type UpdateCache
- type WorkerOptions
Constants ¶
View Source
const CacheTTL = 4 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func AssetCandidates ¶
func AssetCandidates(platform ReleasePlatform) []string
func CompareVersions ¶
func GetDefaultCachePath ¶
func GetDefaultCachePath() string
func IsCacheFresh ¶
func IsCacheFresh(cache *UpdateCache, ttl time.Duration) bool
func NormalizeReleaseVersion ¶
func ReadCachedUpdateNotice ¶
func ReleaseChannel ¶
func SpawnUpdateWorker ¶
func WriteCache ¶
func WriteCache(path string, cache *UpdateCache) error
Types ¶
type GitHubAsset ¶
type GitHubRelease ¶
type ReleaseAsset ¶
func FindCompatibleAsset ¶
func FindCompatibleAsset(release GitHubRelease, platform ReleasePlatform) *ReleaseAsset
type ReleaseCatalog ¶
type ReleaseCatalog struct {
SchemaVersion int `json:"schemaVersion"`
Command string `json:"command"`
CurrentVersion string `json:"currentVersion"`
LatestStableVersion string `json:"latestStableVersion"`
Releases []ReleaseCatalogEntry `json:"releases"`
}
func FetchReleaseCatalog ¶
func FetchReleaseCatalog(apiURL string, platform ReleasePlatform, currentVersion string, client *http.Client) (*ReleaseCatalog, error)
type ReleaseCatalogEntry ¶
type ReleaseCatalogEntry struct {
Tag string `json:"tag"`
Version string `json:"version"`
Channel string `json:"channel"`
Prerelease bool `json:"prerelease"`
PublishedAt *string `json:"publishedAt"`
Current bool `json:"current"`
LatestStable bool `json:"latestStable"`
CompatibleAsset *ReleaseAsset `json:"compatibleAsset"`
}
type ReleasePlatform ¶
func ResolveUpgradePlatform ¶
func ResolveUpgradePlatform(goos, goarch string) (ReleasePlatform, error)
type UpdateCache ¶
type UpdateCache struct {
NewVersionAvailable bool `json:"newVersionAvailable"`
LatestVersion string `json:"latestVersion"`
UpgradeCommand string `json:"upgradeCommand,omitempty"`
LastCheck string `json:"lastCheck"`
}
func ReadCache ¶
func ReadCache(path string) (*UpdateCache, error)
func RunUpdateWorker ¶
func RunUpdateWorker(opts WorkerOptions) (*UpdateCache, error)
Click to show internal directories.
Click to hide internal directories.