selfupdate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetNameForPlatform

func AssetNameForPlatform(version, goos, goarch string) string

AssetNameForPlatform returns a platform's GoReleaser asset name.

func CompareVersions

func CompareVersions(left, right string) (int, bool)

CompareVersions compares two semantic release versions.

func NormalizeVersion

func NormalizeVersion(version string) string

NormalizeVersion removes a release tag's optional leading v.

Types

type ApplyOptions

type ApplyOptions struct {
	Client     *Client
	CurrentVer string
	Force      bool
	DestPath   string
	GOOS       string
	GOARCH     string
}

ApplyOptions controls release selection and executable replacement.

type Asset

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

Asset is a downloadable GitHub release asset.

type CheckResult

type CheckResult struct {
	Current    string
	Latest     string
	Update     bool
	Applied    bool
	Comparable bool
	Asset      string
}

CheckResult describes the latest release for the current version.

func Apply

func Apply(ctx context.Context, opts ApplyOptions) (CheckResult, error)

Apply downloads, verifies, extracts, and installs the latest release.

type Client

type Client struct {
	HTTP    *http.Client
	Repo    string
	BaseURL string
	Token   string
}

Client fetches release metadata and assets.

func (*Client) Download

func (c *Client) Download(ctx context.Context, assetURL string, dst io.Writer) error

Download writes a release asset to dst.

func (*Client) LatestRelease

func (c *Client) LatestRelease(ctx context.Context) (Release, error)

LatestRelease fetches the repository's latest release.

type Release

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

Release is the subset of a GitHub release needed for self-update.

Jump to

Keyboard shortcuts

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