update

package
v1.3.72 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyUpToDate = errors.New("already up to date")
View Source
var ErrNeedsElevation = errors.New("update requires elevation")

ErrNeedsElevation indicates the target directory requires elevated privileges. On Windows the caller should relaunch the helper with UAC.

Functions

func FormatOtherInstalls added in v1.3.72

func FormatOtherInstalls(installs []OtherInstall) string

FormatOtherInstalls returns a human-readable summary of other installs found.

func PackageManagerHint added in v1.3.72

func PackageManagerHint(execPath string) string

PackageManagerHint returns the package manager that likely installed the binary at execPath, or empty string if unknown.

func RunHelper

func RunHelper(manifestPath string) error

Types

type CheckResult

type CheckResult struct {
	CurrentVersion string    `json:"current_version"`
	LatestVersion  string    `json:"latest_version"`
	HasUpdate      bool      `json:"has_update"`
	CheckedAt      time.Time `json:"checked_at"`
}

type DualScopeInstall added in v1.3.72

type DualScopeInstall struct {
	UserPath    string // perUser MSI install path (LocalAppData)
	MachinePath string // perMachine MSI install path (Program Files)
}

DualScopeInstall represents a Windows-specific conflict where both perUser and perMachine ggcode installations exist simultaneously.

func DetectDualScopeWindows added in v1.3.72

func DetectDualScopeWindows() *DualScopeInstall

DetectDualScopeWindows checks if both perUser and perMachine ggcode installations exist on Windows. Returns the conflict info or nil.

type HelperManifest

type HelperManifest struct {
	ParentPID       int      `json:"parent_pid"`
	SourceBinary    string   `json:"source_binary"`
	TargetPaths     []string `json:"target_paths"`
	RestartPath     string   `json:"restart_path"`
	RestartArgs     []string `json:"restart_args"`
	WorkingDir      string   `json:"working_dir"`
	ExpectedVersion string   `json:"expected_version"`
}

type OtherInstall added in v1.3.72

type OtherInstall struct {
	Path       string // absolute path to the binary
	Version    string // version string if known, empty otherwise
	Source     string // "brew", "scoop", "winget", "winget-user", "winget-machine", "npm", "pip", "go", "system", "snap", "path"
	Privileged bool   // true if installed in a system-wide location requiring admin/root
}

OtherInstall represents a ggcode binary found at a different location.

func FindOtherInstalls added in v1.3.72

func FindOtherInstalls(currentPath string) []OtherInstall

FindOtherInstalls scans known installation paths for ggcode binaries other than the one at currentPath. Returns a list of all found installs.

type PreparedUpdate

type PreparedUpdate struct {
	Version      string
	HelperPath   string
	ManifestPath string
}

type Service

type Service struct {
	CurrentVersion string
	ExecPath       string
	ConfigPath     string
	WorkDir        string
	WrapperKind    string
	CheckTTL       time.Duration
	HTTPClient     *http.Client
	// contains filtered or unexported fields
}

func NewService

func NewService(currentVersion, execPath, configPath, workDir string) *Service

func (*Service) Check

func (s *Service) Check(ctx context.Context) (CheckResult, error)

func (*Service) LaunchHelper

func (s *Service) LaunchHelper(prepared PreparedUpdate) error

func (*Service) Prepare

func (s *Service) Prepare(ctx context.Context, resumeID string) (PreparedUpdate, error)

Jump to

Keyboard shortcuts

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