Documentation
¶
Overview ¶
Package selfupdate finds newer releases of the modlock command line and installs one over the running executable.
Index ¶
- func Asset() string
- func Check(ctx context.Context, current string, found func(latest string))
- func Clean()
- func Executable() (string, error)
- func Install(ctx context.Context, version, exe string) error
- func Latest(ctx context.Context) (string, error)
- func Newer(latest, current string) bool
- func Released(version string) bool
- func Remember(latest string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
func Asset() string
Asset returns the name of the release file that holds the command line for this computer.
func Check ¶
Check calls found with the newest release when it is later than current. It answers at once from the answer cached in the user cache, which holds the newest tag and, as its modification time, when it was learned. When that is older than a day it also asks GitHub in the background and calls found again if the fresh answer is later still. found runs at most twice, on any goroutine, and never after ctx ends. Every failure is dropped: the check must never slow or fail the command that runs it.
func Clean ¶
func Clean()
Clean removes the file an update on Windows moved aside, once the command line that ran from it has exited. It does nothing elsewhere.
func Executable ¶
Executable returns the file of the running command line, through any symbolic link that names it.
func Install ¶
Install replaces the executable at exe with the command line of the release tagged version. It downloads the new file beside exe, runs it once to check that it starts and names version, and only then renames it into place, so a failed or interrupted update leaves the old command line working. An error wrapping fs.ErrPermission means exe's directory is not writable.
Types ¶
This section is empty.