Documentation
¶
Overview ¶
Package update implements `w17ctl update`.
Index ¶
Constants ¶
const InstallerURL = "https://get.w17.dev/install.sh"
InstallerURL is the canonical installer. It is the ONE place that knows how to resolve "which release is newest", and this command does not learn a second way — see Cmd.
Variables ¶
var RunInstallerFn = runInstaller
RunInstallerFn shells out to the installer. Indirected so tests can drive the command without a network or a write to a real bin directory.
Functions ¶
func OnPrereleaseTrack ¶
func OnPrereleaseTrack() bool
OnPrereleaseTrack reports whether this binary should be offered prereleases — i.e. whether the installer gets `--pre`.
TRUE while this binary is itself a prerelease, which is the state every consumer is in today: `latest` means the newest STABLE release, so a client that only ever offered stable upgrades would tell every current user there is nothing to install. It flips off by itself the moment a stable release is what is running — no flag day, no second thing to remember.
An unset Version is a local build (`core.VersionString` reports "dev") and counts as a prerelease: a developer running a self-built binary who asks what is newest wants the newest thing that exists, and the stable track would resolve to nothing at all during rc.
Exported because `version --check` asks the same question, and it has to get the SAME answer. Two copies of this rule would mean `--check` could report a release `update` would not install — a disagreement nobody would notice until it mattered.
Types ¶
type Cmd ¶
type Cmd struct {
Version string `help:"Install this exact release instead of the newest (e.g. v0.1.0-rc.46)." placeholder:"TAG"`
Dir string `help:"Install into this directory instead of the one this binary is running from." placeholder:"PATH"`
Stable bool `help:"Refuse prereleases. Off by default while this binary is itself a prerelease — see the note in --help."`
DryRun bool `name:"dry-run" help:"Resolve the release that WOULD be installed and print it, changing nothing."`
}
Cmd upgrades this binary in place by invoking the canonical installer.
It does NOT resolve the release itself, and that restraint is the whole design. `install.sh` picks the newest release with an awk key that exists because of a real incident: on 2026-09-08 taking the GitHub API's first row returned `v0.1.0-rc.9` while `rc.10` existed — the list is ordered by creation, not by version — so the older build was installed, and it carried a security defect the newer one fixed. A Go reimplementation would be a second place for that to come back, and the two would drift without ever disagreeing loudly. So: one resolver, invoked.
The installer also verifies the download against the release's SHA256SUMS and cannot be told not to. Inheriting that is the other half of the reason this command is a caller rather than a downloader.