1
0
mirror of https://github.com/taigrr/go-selfupdate synced 2025-01-18 04:33:12 -08:00
Mark c9b625feac
Merge pull request #33 from m9rco/master
fix : change the logical replication
2021-01-06 08:34:04 -08:00
2019-03-29 17:33:41 -07:00
2020-03-13 09:01:05 +08:00
2021-01-05 17:22:13 -08:00
2019-03-29 17:33:41 -07:00
2015-02-15 11:03:58 -08:00
2014-03-08 09:25:25 -08:00
2019-03-29 17:31:36 -07:00

go-selfupdate

GoDoc Build Status

Enable your Golang applications to self update. Inspired by Chrome based on Heroku's hk.

Features

  • Tested on Mac, Linux, Arm, and Windows
  • Creates binary diffs with bsdiff allowing small incremental updates
  • Falls back to full binary update if diff fails to match SHA

QuickStart

Install library and update/patch creation utility

go get -u github.com/sanbornm/go-selfupdate/...

Enable your App to Self Update

var updater = &selfupdate.Updater{
	CurrentVersion: version,
	ApiURL:         "http://updates.yourdomain.com/",
	BinURL:         "http://updates.yourdomain.com/",
	DiffURL:        "http://updates.yourdomain.com/",
	Dir:            "update/",
	CmdName:        "myapp", // app name
}

if updater != nil {
	go updater.BackgroundRun()
}

Push Out and Update

go-selfupdate myapp 1.2

This will create a folder in your project called, public you can then rsync or transfer this to your webserver or S3.

If you are cross compiling you can specify a directory:

go-selfupdate /tmp/mybinares/ 1.2

The directory should contain files with the name, $GOOS-$ARCH. Example:

windows-386
darwin-amd64
linux-arm

If you are using goxc you can output the files with this naming format by specifying this config:

"OutPath": "{{.Dest}}{{.PS}}{{.Version}}{{.PS}}{{.Os}}-{{.Arch}}",
Description
Enable your Go applications to self update
Readme 132 KiB
Languages
Go 88.4%
Shell 11.1%
HTML 0.5%