update

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package update provides the ability to check GitHub for the newest release tag.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheYaml = errors.New("set cache cannot marshal yaml")
	ErrCacheData = errors.New("set cache cannot create a data path")
	ErrCacheSave = errors.New("set cache cannot save data")
)

Functions

func CacheSet

func CacheSet(etag, version string) error

CacheSet saves the Github API, ETag HTTP header and release version.

func Check

func Check() (string, error)

Check the GitHub for the newest release tag. The returned string will only contain the newest available release tag if the local program version is out of date.

func Compare

func Compare(current, fetched string) bool

Compare reports whether the release version of this program matches the latest version hosted on GitHub.

func Notice

func Notice(w io.Writer, old, current string)

Notice writes a new release notification box and text.

Types

type Cache

type Cache struct {
	Etag    string `yaml:"etag"`    // http etag header
	Version string `yaml:"version"` // semantic version
}

Cache of the newest production release. The Etag string is used to check if the release has changed, by requesting a tiny HTTP header from the GitHub API instead of the full response.

func CacheGet

func CacheGet() Cache

CacheGet reads and returns the locally cached GitHub API.

Jump to

Keyboard shortcuts

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