selfupdate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package selfupdate replaces the running plugyard program with the latest release.

Index

Constants

View Source
const ChecksumsName = "checksums.txt"

ChecksumsName is the release file that lists the SHA-256 of every archive.

View Source
const DefaultBase = "https://github.com/Amraa1/plugyard"

DefaultBase is where plugyard's releases are published.

Variables

View Source
var ErrNoRelease = errors.New("no release of plugyard has been published yet")

ErrNoRelease is returned when nothing has been released yet.

Functions

func AssetName

func AssetName(goos, goarch string) string

AssetName returns the name of the release archive for a system.

func CleanOld

func CleanOld(exePath string)

CleanOld removes what an earlier update left beside the program.

func Newer

func Newer(current, latest string) bool

Newer reports whether version latest is newer than version current. A current version that is not a release, such as "dev", is older than any release.

func Replace

func Replace(exePath string, program []byte) error

Replace puts a new program in place of the one at exePath. If it fails, the program that was there is still there.

Types

type Updater

type Updater struct {
	// Base is the address of the project, such as DefaultBase.
	Base   string
	Client *http.Client
	// OS and Arch name the build to fetch, in Go's terms.
	OS, Arch string
	// UserAgent is sent with every request.
	UserAgent string
}

Updater fetches releases.

func (*Updater) Download

func (u *Updater) Download(ctx context.Context, tag string) ([]byte, error)

Download fetches the program of a release for the updater's system, and checks it against the release's checksums.

func (*Updater) Latest

func (u *Updater) Latest(ctx context.Context) (string, error)

Latest returns the version tag of the latest release, such as "v0.2.0".

Jump to

Keyboard shortcuts

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