update

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownRepo = errors.New("update repo not set")
	ErrNoRelease   = errors.New("no release available")
	ErrNoUpdate    = errors.New("already on latest version")
	ErrNoAsset     = errors.New("platform asset not found")
)
View Source
var ErrInvalidSemver = errors.New("invalid semantic version")
View Source
var (
	ErrPendingSwap = errors.New("update staged; restart required to complete")
)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name string
	URL  string
	Size int64
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(h *http.Client, repo string) (Client, error)

func (Client) Check

func (c Client) Check(ctx context.Context, curr string, plat Platform) (Result, error)

func (Client) Download

func (c Client) Download(ctx context.Context, a Asset, dst string, prog Progress) (int64, error)

func (Client) FetchChecksum

func (c Client) FetchChecksum(ctx context.Context, a Asset) (string, error)

func (Client) Latest

func (c Client) Latest(ctx context.Context) (Info, error)

func (Client) Ready

func (c Client) Ready() bool

func (Client) WithAPI

func (c Client) WithAPI(v string) Client

type Info

type Info struct {
	Version   string
	Notes     string
	Published time.Time
	Assets    []Asset
}

func (Info) Asset

func (i Info) Asset(name string) (Asset, bool)

type Platform

type Platform struct {
	OS    string
	Arch  string
	Asset string
	Sum   string
}

func Detect

func Detect() (Platform, error)

func For

func For(goos, goarch string) (Platform, error)

type Progress added in v0.4.3

type Progress interface {
	Start(total int64)
	Advance(n int64)
	Finish()
}

type Result

type Result struct {
	Info   Info
	Bin    Asset
	Sum    Asset
	HasSum bool
}

type SwapStatus

type SwapStatus struct {
	Pending bool
	NewPath string
}

func Apply

func Apply(ctx context.Context, c Client, res Result, exe string) (SwapStatus, error)

func ApplyWithProgress added in v0.4.3

func ApplyWithProgress(ctx context.Context, c Client, res Result, exe string, prog Progress) (SwapStatus, error)

Jump to

Keyboard shortcuts

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