updates

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: AGPL-3.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndSelfUpdate added in v1.13.0

func CheckAndSelfUpdate(cfg SelfUpdateConfig) error

CheckAndSelfUpdate contacts the pangolin server, checks whether a newer version of newt is available, downloads it if so, replaces the running binary on disk, and re-executes from the new binary.

It returns an error when the check or update fails. On a successful update the function does not return – the process is replaced by the new binary via syscall.Exec.

func CheckForUpdate

func CheckForUpdate(owner, repo, currentVersion string) error

CheckForUpdate checks GitHub for a newer version and prints an update banner if found

Types

type GitHubRelease

type GitHubRelease struct {
	TagName string `json:"tag_name"`
	Name    string `json:"name"`
	HTMLURL string `json:"html_url"`
}

GitHubRelease represents the GitHub API response for a release

type SelfUpdateConfig added in v1.13.0

type SelfUpdateConfig struct {
	// Endpoint is the base URL of the pangolin server (e.g. "https://app.pangolin.net")
	Endpoint string
	// NewtID is the newt client identifier used for authentication.
	NewtID string
	// Secret is the newt client secret used for authentication.
	Secret string
	// CurrentVersion is the version of the currently running binary.
	CurrentVersion string
	// Platform is the OS+arch string embedded at build time via ldflags
	// (e.g. "linux_amd64", "darwin_arm64").  When non-empty it is used
	// directly; when empty the value is derived from runtime.GOOS/GOARCH.
	Platform string
	// TLSConfig is an optional TLS configuration for the HTTP client (may be nil).
	TLSConfig *tls.Config
}

SelfUpdateConfig holds the configuration required to perform a self-update.

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version

func (Version) String

func (v Version) String() string

String returns the version as a string

Jump to

Keyboard shortcuts

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