upgrade

package
v0.12.17 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2016 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package upgrade downloads and compares releases, and upgrades the running binary.

Index

Constants

View Source
const (
	MajorOlder Relation = -2 // Older by a major version (x in x.y.z or 0.x.y).
	Older               = -1 // Older by a minor version (y or z in x.y.z, or y in 0.x.y)
	Equal               = 0  // Versions are semantically equal
	Newer               = 1  // Newer by a minor version (y or z in x.y.z, or y in 0.x.y)
	MajorNewer          = 2  // Newer by a major version (x in x.y.z or 0.x.y).
)
View Source
const DisabledByCompilation = false

Variables

View Source
var (
	ErrVersionUpToDate    = errors.New("current version is up to date")
	ErrNoReleaseDownload  = errors.New("couldn't find a release to download")
	ErrNoVersionToSelect  = errors.New("no version to select")
	ErrUpgradeUnsupported = errors.New("upgrade unsupported")
	ErrUpgradeInProgress  = errors.New("upgrade already in progress")
)
View Source
var SigningKey = []byte(`-----BEGIN EC PUBLIC KEY-----
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQA1iRk+p+DsmolixxVKcpEVlMDPOeQ
1dWthURMqsjxoJuDAe5I98P/A0kXSdBI7avm5hXhX2opJ5TAyBZLHPpDTRoBg4WN
7jUpeAjtPoVVxvOh37qDeDVcjCgJbbDTPKbjxq/Ae3SHlQMRcoes7lVY1+YJ8dPk
2oPfjA6jtmo9aVbf/uo=
-----END EC PUBLIC KEY-----`)

SigningKey is the public key used to verify signed upgrades. It must match the private key used to sign binaries for the built in upgrade mechanism to accept an upgrade. Keys and signatures can be created and verified with the stsigtool utility. The build script creates signed binaries when given the -sign option.

Functions

func To

func To(rel Release) error

func ToURL

func ToURL(url string) error

Types

type Asset

type Asset struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

type Relation

type Relation int

func CompareVersions

func CompareVersions(a, b string) Relation

CompareVersions returns a relation describing how a compares to b.

type Release

type Release struct {
	Tag        string  `json:"tag_name"`
	Prerelease bool    `json:"prerelease"`
	Assets     []Asset `json:"assets"`
}

func FetchLatestReleases added in v0.12.5

func FetchLatestReleases(releasesURL, version string) []Release

FetchLatestReleases returns the latest releases, including prereleases or not depending on the argument

func LatestRelease

func LatestRelease(releasesURL, version string) (Release, error)

func SelectLatestRelease

func SelectLatestRelease(version string, rels []Release) (Release, error)

type SortByRelease

type SortByRelease []Release

func (SortByRelease) Len

func (s SortByRelease) Len() int

func (SortByRelease) Less

func (s SortByRelease) Less(i, j int) bool

func (SortByRelease) Swap

func (s SortByRelease) Swap(i, j int)

Jump to

Keyboard shortcuts

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