selfupdate

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 14 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

Index

Constants

View Source
const DefaultBinaryTemplate = "wings_{os}_{arch}"

Variables

View Source
var (
	// ErrUnsupportedArch indicates that the current runtime architecture is not supported.
	ErrUnsupportedArch = errors.New("selfupdate: unsupported architecture")

	// ErrChecksumNotFound indicates that the requested checksum could not be found in the checksum file.
	ErrChecksumNotFound = errors.New("selfupdate: checksum not found for binary")

	// ErrChecksumRequired indicates that a checksum must be supplied for direct downloads.
	ErrChecksumRequired = errors.New("selfupdate: checksum required for direct download")
)

Functions

func DetermineBinaryName

func DetermineBinaryName(template string) (string, error)

DetermineBinaryName resolves the binary asset name using the provided template. The template may include placeholders "{arch}" (amd64/arm64) and "{os}" (runtime GOOS). When template is empty, a default value is used.

func RunRestartCommand

func RunRestartCommand(ctx context.Context, command string) (string, error)

RunRestartCommand executes the provided restart command using /bin/sh -c and returns combined output.

func UpdateFromGitHub

func UpdateFromGitHub(ctx context.Context, owner string, repo string, release ReleaseInfo, binaryTemplate string, skipChecksum bool) (string, error)

func UpdateFromURL

func UpdateFromURL(ctx context.Context, downloadURL string, binaryName string, expectedChecksum string, skipChecksum bool) error

UpdateFromURL downloads a binary from the specified URL and replaces the current binary. If expectedChecksum is provided it will be validated prior to replacing the binary unless skipChecksum is true.

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	URL        string
}

HTTPError represents a non-successful HTTP response from an upstream service.

func (*HTTPError) Error

func (e *HTTPError) Error() string

type ReleaseAsset

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

type ReleaseInfo

type ReleaseInfo struct {
	TagName string         `json:"tag_name"`
	Assets  []ReleaseAsset `json:"assets"`
}

func FetchLatestReleaseInfo

func FetchLatestReleaseInfo(ctx context.Context, owner string, repo string) (ReleaseInfo, error)

func FetchReleaseByTag

func FetchReleaseByTag(ctx context.Context, owner string, repo string, tag string) (ReleaseInfo, error)

Jump to

Keyboard shortcuts

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