Documentation
¶
Overview ¶
Copyright © 2022 Diego Morales <dgmorales@gmail.com>
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
Types ¶
type UpdateDecision ¶ added in v0.2.1
type UpdateDecision int
UpdateDecision informs if our version is latest, can or must update.
Its values may be used as shell exit status codes for a version check command.
const ( IsLatest UpdateDecision = 0 CanUpdate UpdateDecision = 10 MustUpdate UpdateDecision = 20 )
won't use iota bellow because values matter
func Check ¶
func Check(i *CliInfo, gh *github.Client) (UpdateDecision, error)
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)