Documentation
¶
Overview ¶
Copyright © 2022 Diego Morales <dgmorales@gmail.com>
Index ¶
- Constants
- func Check(i *CliInfo, gh *github.Client) (updateDecision, error)
- func DownloadAndApply(i CliInfo, gh *github.Client)
- func NewClient() *github.Client
- func StringToVersionHookFunc(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error)
- func Uncompress(filename string) (io.Reader, func(), error)
- type CliInfo
Constants ¶
const ( IsLatest updateDecision = 0 CanUpdate updateDecision = 1 MustUpdate updateDecision = 2 )
won't use iota bellow because values matter
Variables ¶
This section is empty.
Functions ¶
func Check ¶
checkVersion checks if current version can or must be updated
check is internal and meant to be easily testable It is OK for the version information on cliInfo to be unset (nil), maybe because of previous errors parsing it. That is a noop and will return IsLatest and nil error on that case.
It does return error on some very abnormal cases (gross programming errors)
func DownloadAndApply ¶
func StringToVersionHookFunc ¶
func StringToVersionHookFunc(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error)
StringToVersionHookFunc is a mapstructure HookFunc to convert a string to a hashicorp/go-version Version pointer
This will be passed to mapstructure.Decoder and called for every field in the source structure being mapped, so we must "passthrough" if the field types don't match