Documentation ¶
Overview ¶
Package upgrade downloads and compares releases, and upgrades the running binary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Asset ¶
An Asset is an archive file for a given OS and architecture.
func MatchingAssets ¶
MatchingAssets returns the list of assets that have names matching the given expression. I.e., to get a list of assets suitable for Darwin/AMD64 where the convention is for assets to contain {{runtime.GOOS}}-{{runtime.GOARCH}} in the name:
assets := MatchingAssets(regex.MustCompile(`darwin-amd64`), myRelease)
type Release ¶
type Release struct { // The Version should be in semver format, i.e. "0.1.2" or "v2.3.4". Version string // Assets are the actual files that make up the release, being one archive // file per OS and architecture. Assets []Asset }
A Release represents a given software release.
func GithubReleases ¶
func GithubReleases(project string, currentVersion string, allowMajorUpgrade bool, allowPrerelease bool) ([]Release, error)
GithubRelease returns a list of releases for the project that are newer than currentVersion. If allowMajorUpgrade is false, releases that are majorly newer than current are filtered out. If allowPrerelease is false, prerelease releases are filtered out. If an error occurs, the list of releases is empty and an error is set. An empty list of releases and a nil error means that no error ocurred, but there is no newer release available that meets the criteria.
rels, err := GithubReleases("calmh/someproject", "v1.2.3", true, false)