go-selfupdate

command module
v0.0.0-...-949f83d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2017 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-selfupdate

This is was based on work from sanbornm/go-selfupdate but with updates to make suite the needs of my software

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
    • brew install bsdiff on Mac
  • Falls back to full binary update if diff fails to match SHA

QuickStart

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 {
		// check if an update is available first
		new_version, err := updater.HasUpdate()
		
		if new_version != "" {
			fmt.Printf("Upgrading to v%s\n", new_version)
			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}}",

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
example
Update protocol: GET hk.heroku.com/hk/linux-amd64.json 200 ok { "Version": "2", "Sha256": "..." // base64 } then GET hkpatch.s3.amazonaws.com/hk/1/2/linux-amd64 200 ok [bsdiff data] or GET hkdist.s3.amazonaws.com/hk/2/linux-amd64.gz 200 ok [gzipped executable data]
Update protocol: GET hk.heroku.com/hk/linux-amd64.json 200 ok { "Version": "2", "Sha256": "..." // base64 } then GET hkpatch.s3.amazonaws.com/hk/1/2/linux-amd64 200 ok [bsdiff data] or GET hkdist.s3.amazonaws.com/hk/2/linux-amd64.gz 200 ok [gzipped executable data]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址