Documentation
¶
Overview ¶
Package selfupdate implements explicit, verified release updates and optional notices.
Index ¶
- Constants
- func Cleanup(executable string)
- func Compare(a, b string) int
- func Eligible(command, version string, tty bool, getenv func(string) string) bool
- func Enabled(s Settings, getenv func(string) string) bool
- func Executable() (string, error)
- func Installation(executable, version string) string
- func Replace(items []Replacement) error
- func SaveSettings(file string, s Settings) error
- func ValidVersion(v string) bool
- func ValidateBaseURL(raw string) error
- func Writable(executable string) error
- type Checker
- type Releases
- type Replacement
- type Settings
Constants ¶
const DefaultInterval = time.Hour
const MinimumInterval = 15 * time.Minute
const Repository = "https://github.com/csautter/sailwright"
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶
func Cleanup(executable string)
Cleanup removes Windows backups on a subsequent invocation. In-use files stay put.
func Compare ¶
Compare compares stable release versions without integer overflow. Invalid versions (such as "dev") sort below every valid version and equal each other.
func Executable ¶
func Installation ¶
Installation classifies the resolved path, including Homebrew's symlink targets.
func Replace ¶
func Replace(items []Replacement) error
Replace stages all verified binaries beside their targets before changing anything. Unix renames each binary atomically. Windows keeps the previous executable as .old. If any rename fails, completed changes are rolled back.
func SaveSettings ¶
func ValidVersion ¶
ValidVersion accepts stable release versions only; development builds cannot update.
func ValidateBaseURL ¶
ValidateBaseURL limits the release source override to local test fixtures, so a leaked environment variable cannot redirect updates to a remote server.
Types ¶
type Checker ¶
func (Checker) Start ¶
Start reserves a short retry window before launching a bounded request. The interval starts only once a request completes, so a command that exits before the response arrives does not suppress checks for a whole interval. Finish waits at most noticeGrace for a pending request; a later result is used on the next run.
type Releases ¶
type Releases struct {
BaseURL string // Repository URL; override only for local release fixtures.
Client *http.Client
Version string
RequireSignature bool
}
type Replacement ¶
type Settings ¶
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings are used when no settings file exists or it cannot be used.
func LoadSettings ¶
LoadSettings always returns usable settings: on error it returns the defaults together with the error, so callers can warn and overwrite a broken file.