updater

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetName

func AssetName(goos, goarch string) string

AssetName returns the expected release asset filename for the given OS and architecture.

func DownloadAndReplace

func DownloadAndReplace(url string) error

DownloadAndReplace downloads the binary from url and replaces the running executable.

func FindAssetURL

func FindAssetURL(rel *GHRelease) (string, string, error)

FindAssetURL finds the download URL for the current platform in a release.

func NeedsUpdate

func NeedsUpdate(currentVersion, constraint string) (bool, error)

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.

func Update

func Update(downloadURL string) (string, error)

Update performs the full update: fetch release, find asset, download, replace. Returns the new version tag on success.

Types

type GHAsset

type GHAsset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

GHAsset is a GitHub release asset.

type GHRelease

type GHRelease struct {
	TagName string    `json:"tag_name"`
	Assets  []GHAsset `json:"assets"`
}

GHRelease is the GitHub API release shape (subset).

func FetchLatestRelease

func FetchLatestRelease(downloadURL string) (*GHRelease, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址