Documentation
¶
Index ¶
- func AssetName(goos, goarch string) string
- func DownloadAndReplace(url string) error
- func FindAssetURL(rel *GHRelease) (string, string, error)
- func NeedsUpdate(currentVersion, constraint string) (bool, error)
- func SelfReExec() error
- func Update(downloadURL string) (string, error)
- type GHAsset
- type GHRelease
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetName ¶
AssetName returns the expected release asset filename for the given OS and architecture.
func DownloadAndReplace ¶
DownloadAndReplace downloads the binary from url and replaces the running executable.
func FindAssetURL ¶
FindAssetURL finds the download URL for the current platform in a release.
func NeedsUpdate ¶
NeedsUpdate returns true if currentVersion does not satisfy the constraint. Returns false for dev builds or empty constraints.
func SelfReExec ¶
func SelfReExec() error
SelfReExec replaces the current process with a new execution of the same binary and args.
Types ¶
type GHAsset ¶
type GHAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
}
GHAsset is a GitHub release asset.
type GHRelease ¶
GHRelease is the GitHub API release shape (subset).
func FetchLatestRelease ¶
FetchLatestRelease fetches the latest release info from GitHub (or a custom base URL). downloadURL should be like "https://github.com/loopingz/webda.cli/releases" or empty for default.