Documentation
¶
Index ¶
- Variables
- func FormatOtherInstalls(installs []OtherInstall) string
- func PackageManagerHint(execPath string) string
- func ReadStagedBinary(manifestPath string) (string, error)
- func RunHelper(manifestPath string) error
- type CheckResult
- type DualScopeInstall
- type HelperManifest
- type OtherInstall
- type PreparedUpdate
- type Service
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyUpToDate = errors.New("already up to date")
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
PackageManagerHint returns the package manager that likely installed the binary at execPath, or empty string if unknown.
func ReadStagedBinary ¶ added in v1.3.76
ReadStagedBinary reads a manifest file and returns the path to the staged (downloaded) binary. Used by the restart helper to know which file to install.
Types ¶
type CheckResult ¶
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 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 (*Service) ApplyBinary ¶ added in v1.3.76
func (s *Service) ApplyBinary(prepared PreparedUpdate) error
ApplyBinary replaces the binary files directly without spawning a helper process or starting a new instance. This is used on Unix where the running binary can be overwritten in place. After ApplyBinary returns, the caller should use restart.ExecSelf (syscall.Exec) to load the new binary, keeping the same PID, process group, and terminal control.
func (*Service) LaunchHelper ¶
func (s *Service) LaunchHelper(prepared PreparedUpdate) error