Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AutoUpdater = &Updater{ CurrentVersion: config.VERSION, APIURL: "https://s3.amazonaws.com/cli-autoupdates/", BinURL: "https://s3.amazonaws.com/cli-autoupdates/", DiffURL: "https://s3.amazonaws.com/cli-autoupdates/", Dir: ".catalyze_update", CmdName: "catalyze", }
AutoUpdater to perform full replacements on the CLI binary
var ErrHashMismatch = errors.New("new file hash mismatch after patch")
ErrHashMismatch represents a mismatch in the expected hash and the calculated hash
Functions ¶
This section is empty.
Types ¶
type Updater ¶
type Updater struct { CurrentVersion string // Currently running version. APIURL string // Base URL for API requests (json files). CmdName string // Command name is appended to the ApiURL like http://apiurl/CmdName/. This represents one binary. BinURL string // Base URL for full binary downloads. DiffURL string // Base URL for diff downloads. Dir string // Directory to store selfupdate state. Info struct { Version string Sha256 []byte } }
Updater is the configuration and runtime data for doing an update.
Note that ApiURL, BinURL and DiffURL should have the same value if all files are available at the same location.
Example:
updater := &selfupdate.Updater{ CurrentVersion: version, ApiURL: "http://updates.yourdomain.com/", BinURL: "http://updates.yourdownmain.com/", DiffURL: "http://updates.yourdomain.com/", Dir: "update/", CmdName: "myapp", // app name } if updater != nil { go updater.BackgroundRun() }
func (*Updater) BackgroundRun ¶
BackgroundRun starts the update check and apply cycle.
func (*Updater) FetchInfo ¶
FetchInfo fetches and updates the info for latest CLI version available.
func (*Updater) ForcedUpgrade ¶
ForcedUpgrade writes a time in the past to the cktime file and then triggers the normal update process. This is useful when an update is required for the program to continue functioning normally.