selfupdate

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Repo = "danlafeir/em"

Variables

This section is empty.

Functions

func AssetURL

func AssetURL(assets []Asset) string

AssetURL returns the download URL for the binary matching the current OS and architecture, or an empty string if no matching asset was found.

func IsNewer

func IsNewer(tagName, currentVersion string) bool

IsNewer reports whether tagName is a newer release than currentVersion.

Both values may be "vX.Y.Z", "vX.Y.Z-N-gHASH" (git describe output), or a bare commit hash. A bare hash is treated as older than any semver tag so that users on pre-release dev builds always receive an upgrade prompt.

func Run

func Run(currentVersion string, cmd *cobra.Command)

Run checks for a newer release and, if one exists, downloads it and replaces the running binary. Called by the `em update` command.

Types

type Asset

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

Asset is a single downloadable file attached to a release.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	Assets  []Asset `json:"assets"`
}

Release is a minimal representation of a GitHub Release API response.

func LatestRelease

func LatestRelease() (*Release, error)

LatestRelease fetches the latest published GitHub Release for em. Returns nil, nil when no releases have been published yet.

func LatestReleaseFor

func LatestReleaseFor(repo string) (*Release, error)

LatestReleaseFor fetches the latest release for the given "owner/repo". Separated for testing.

Jump to

Keyboard shortcuts

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