Documentation
¶
Overview ¶
Package update checks for an available update on GitHub. It has baked in assumptions, but is mostly portable.
Index ¶
Constants ¶
const Latest = "https://api.github.com/repos/%s/releases/latest"
Latest is where we find the latest release.
Variables ¶
var OSsuffixMap = map[string]string{
"darwin": ".dmg",
"windows": ".exe.zip",
"freebsd": ".txz",
"linux": "",
}
OSsuffixMap is the OS to file suffix map for downloads.
Functions ¶
This section is empty.
Types ¶
type GHasset ¶
type GHasset struct {
URL string `json:"url"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
Label string `json:"label"`
Uploader GHuser `json:"uploader"`
ContentType string `json:"content_type"`
State string `json:"state"`
Size int `json:"size"`
DownloadCount int `json:"download_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
BrowserDownloadURL string `json:"browser_download_url"`
}
GHasset is part of GitHubReleasesLatest.
type GHuser ¶
type GHuser struct {
Login string `json:"login"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
}
GHuser is part of GitHubReleasesLatest.
type GitHubReleasesLatest ¶
type GitHubReleasesLatest struct {
URL string `json:"url"`
AssetsURL string `json:"assets_url"`
UploadURL string `json:"upload_url"`
HTMLURL string `json:"html_url"`
ID int64 `json:"id"`
Author GHuser `json:"author"`
NodeID string `json:"node_id"`
TagName string `json:"tag_name"`
TargetCommitish string `json:"target_commitish"`
Name string `json:"name"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
CreatedAt time.Time `json:"created_at"`
PublishedAt time.Time `json:"published_at"`
Assets []GHasset `json:"assets"`
TarballURL string `json:"tarball_url"`
ZipballURL string `json:"zipball_url"`
Body string `json:"body"`
}
GitHubReleasesLatest is the output from the releases/latest API on GitHub.
func GetRelease ¶
func GetRelease(uri string) (*GitHubReleasesLatest, error)
GetRelease returns a GitHub release. See Check for an example on how to use it.
type Update ¶
Update contains running Version, Current version and Download URL for Current version. Outdate is true if the running version is older than the current version.
func FillUpdate ¶
func FillUpdate(release *GitHubReleasesLatest, version string) *Update
FillUpdate compares a current version with the latest GitHub release.