Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // For example, Homebrew cannot be used from Linux. // // The condition is checked at the constructor like github.New(...). // Clients which use go-updater must check this error. ErrUnavailable = errors.New("unavailable means") )
Functions ¶
This section is empty.
Types ¶
type Means ¶
type Means interface { LatestTag(context.Context) (*version.Version, error) Update(context.Context, *version.Version) error Installed(context.Context) bool CommandText(*version.Version) string Type() MeansType }
Means manages methods related to specified update means. For example, fetches the latest tag, update binary, or check whether the software is installed by this.
func NewMeans ¶
func NewMeans(b MeansBuilder) (Means, error)
func SelectAvailableMeansFrom ¶
func SelectAvailableMeansFrom(ctx context.Context, ma ...MeansBuilder) (Means, error)
type MeansBuilder ¶
type UpdateCondition ¶
type UpdateCondition func(*version.Version, *version.Version) bool
UpdateCondition is the condition for update the binary. when the binary will be updated, always go-updater checks the condition specified by this.
var ( FoundMajorUpdate UpdateCondition = func(current, latest *version.Version) bool { return current.LessThan(latest) && current.Segments()[0] < latest.Segments()[0] } FoundMinorUpdate UpdateCondition = func(current, latest *version.Version) bool { return current.LessThan(latest) && (current.Segments()[0] < latest.Segments()[0] || current.Segments()[1] < latest.Segments()[1]) } FoundPatchUpdate UpdateCondition = func(current, latest *version.Version) bool { return current.LessThan(latest) } )
type Updater ¶
type Updater struct { UpdateIf UpdateCondition // contains filtered or unexported fields }
Updater updates the binary using with UpdateCondition and Means. updating can be executed by m when UpdateIf is true.
func (*Updater) PrintInstruction ¶
Click to show internal directories.
Click to hide internal directories.