Documentation
¶
Overview ¶
Package update checks GitHub Releases for a newer Velo, downloads its installer and verifies it before running it.
A release is tagged vX.Y.Z and has an asset named Velo-Setup-X.Y.Z.exe. The download must match a SHA-256 checksum: GitHub's own asset digest when available, otherwise a Velo-Setup-X.Y.Z.exe.sha256 asset next to it.
Index ¶
Constants ¶
const MaxSize = 300 << 20
MaxSize is the largest installer accepted.
Variables ¶
var ( Attempts = 6 StallTimeout = 60 * time.Second )
Attempts and StallTimeout bound an update download.
var API = "https://api.github.com/repos/Adoxcol/velo/releases/latest"
API is the "latest release" endpoint (changed in tests).
var ErrNoRelease = errors.New("no published release found")
ErrNoRelease means the repository has no published release (or is private).
var Web = "https://github.com/Adoxcol/velo/releases"
Web is the release page used when the API refuses the check (changed in tests). GitHub allows 60 anonymous API calls an hour per address, which other apps on the same connection also use; the web pages have no such limit.
Functions ¶
func Download ¶
Download saves the installer into dir and checks its SHA-256. A slow or unsteady connection is fine: each attempt continues the partial file from where the last one stopped, and an attempt only gives up when no data arrives for StallTimeout.