update

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 17 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 update provides automatic update functionality for GitHubby

Package update provides automatic update functionality for GitHubby

Index

Constants

View Source
const (
	// RepoOwner is the GitHub repository owner
	RepoOwner = "Didstopia"
	// RepoName is the GitHub repository name
	RepoName = "githubby"
	// ExecutableName is the name of the executable in the release archive.
	// This allows renamed binaries (e.g., "githubby-test") to still update correctly.
	ExecutableName = "githubby"
)

Variables

This section is empty.

Functions

func FormatUpdateNotification

func FormatUpdateNotification(result *Result) string

FormatUpdateNotification returns a formatted string for the update notification

func GetPlatform

func GetPlatform() string

GetPlatform returns the current platform string (os/arch)

func IsDev added in v1.0.4

func IsDev(version string) bool

IsDev returns true if this is a development build that should skip updates

func Restart added in v1.0.4

func Restart() error

Restart replaces the current process with a new instance of the application. On Unix systems, this uses syscall.Exec() for seamless replacement. On Windows, this spawns a new process then exits the current one. Returns an error if the restart fails.

Types

type Result

type Result struct {
	// CurrentVersion is the currently running version
	CurrentVersion string
	// LatestVersion is the latest available version
	LatestVersion string
	// Available indicates if an update is available
	Available bool
	// ReleaseURL is the URL to the release page
	ReleaseURL string
	// ReleaseNotes contains the release notes (if available)
	ReleaseNotes string
}

Result contains information about an available update

func CheckForUpdate

func CheckForUpdate(ctx context.Context, currentVersion string) (*Result, error)

CheckForUpdate is a convenience function that creates an Updater and checks for updates

func Update

func Update(ctx context.Context, currentVersion string) (*Result, error)

Update is a convenience function that creates an Updater and performs an update

type Updater

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

Updater handles checking and performing updates

func NewUpdater

func NewUpdater(currentVersion string) *Updater

NewUpdater creates a new Updater instance

func (*Updater) CheckForUpdate

func (u *Updater) CheckForUpdate(ctx context.Context) (*Result, error)

CheckForUpdate checks if a new version is available

func (*Updater) Update

func (u *Updater) Update(ctx context.Context) (*Result, error)

Update downloads and installs the latest version. This uses a custom extraction that looks for ExecutableName ("githubby") in the archive, allowing renamed binaries (e.g., "githubby-test") to still update correctly.

Jump to

Keyboard shortcuts

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