update

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT 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 update checks GitHub Releases for a newer pgtower and can replace the running binary in place. Everything is best-effort and offline-safe: a failed network call never breaks the app, it just means "no update offered".

Index

Constants

View Source
const LegacyName = "pgtui"

LegacyName is what the binary was called before v0.10.

View Source
const Repo = "9level/pgtower"

Repo is the canonical GitHub "owner/name" pgtower is released from.

Variables

This section is empty.

Functions

func AssetName

func AssetName(version string) string

AssetName is the release asset filename for the running platform, matching the names produced by the Makefile and consumed by install.sh.

func IsNewer

func IsNewer(latest, current string) bool

IsNewer reports whether latest is strictly greater than current. If either is unparseable (e.g. current == "dev"), it returns false — never nag a build we can't reason about.

func IsRelease

func IsRelease(v string) bool

IsRelease reports whether v is a real version tag (so it makes sense to check for updates — dev/source builds are skipped).

func Latest

func Latest(ctx context.Context, repo string) (string, error)

Latest returns the newest published release tag (e.g. "v0.5.0").

func OptOut

func OptOut() error

OptOut persists the "never suggest updates" choice.

func OptedOut

func OptedOut() bool

OptedOut reports whether the user asked to never be prompted again.

func SelfUpdate

func SelfUpdate(ctx context.Context, repo, version string) error

SelfUpdate downloads the release binary for `version`, verifies its SHA256 and atomically replaces the running executable. It returns *ManualError when the install directory is not writable, so the caller can show manual steps.

Types

type ManualError

type ManualError struct {
	Dir  string
	Repo string
}

ManualError means pgtower could not replace its own binary (usually because the install directory needs root). It carries a ready-to-paste instruction.

func (*ManualError) Error

func (e *ManualError) Error() string

func (*ManualError) Instructions

func (e *ManualError) Instructions() string

Instructions returns a human-facing block explaining how to finish the update by hand.

type NameResult

type NameResult struct {
	Renamed bool   // the binary now lives at Path
	Path    string // …/pgtower
	Alias   string // …/pgtui, now a symlink kept for old scripts ("" if none)
	Manual  string // instructions when it could not be done automatically
}

NameResult reports what AdoptName did.

func AdoptName

func AdoptName(arg0 string) (NameResult, error)

AdoptName gives a pgtui-named binary its pgtower name. It runs when the program was started as "pgtui" — typically right after a v0.9 self-update, which replaces the old file in place. The binary is moved to "pgtower" in the same directory and "pgtui" becomes a symlink to it, so existing scripts and habits keep working. Nothing happens when already running as pgtower.

Jump to

Keyboard shortcuts

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