update

package
v0.2.4-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package update implements self-update for evva.

It fetches the latest GitHub Release, compares versions, downloads the correct binary asset for the current OS/arch, and replaces the running binary atomically — no Go toolchain required.

Index

Constants

View Source
const (
	DefaultOwner = "johnny1110"
	DefaultRepo  = "evva"
)

defaults for the bundled evva binary.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, release *Release) (string, error)

Apply downloads the appropriate asset for the current OS/arch from the release, decompresses it, and replaces the currently running binary. Returns the path to the replaced binary.

On Unix the replacement is atomic (os.Rename on the same filesystem). On Windows the replacement is deferred to next launch (the running exe cannot be overwritten).

func CurrentVersion

func CurrentVersion() string

CurrentVersion returns the ldflags-injected version string. Falls back to the compile-time default when ldflags weren't set (dev builds, go run).

Types

type Asset

type Asset struct {
	Name        string // e.g. "evva-darwin-arm64.tar.gz"
	DownloadURL string // browser_download_url
	Size        int64  // bytes
}

Asset is a single downloadable file attached to a release.

type Release

type Release struct {
	Version string  // tag name, e.g. "v0.2.0"
	URL     string  // HTML URL of the release page
	Assets  []Asset // downloadable assets
}

Release represents a GitHub Release with its downloadable assets.

func Check

func Check(ctx context.Context, owner, repo string) (*Release, error)

Check fetches the latest release from GitHub for owner/repo and returns it. If the latest tag matches currentVersion, the release is still returned so the caller can decide what "up-to-date" means (exact match vs newer).

Jump to

Keyboard shortcuts

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