Categorygithub.com/minio/selfupdate
modulepackage
0.6.0
Repository: https://github.com/minio/selfupdate.git
Documentation: pkg.go.dev

# README

API Reference Apache V2 License

selfupdate: Build self-updating Go programs

NOTE: Original work at github.com/inconshreveable/go-update, modified for the needs within MinIO project

Package update provides functionality to implement secure, self-updating Go programs (or other single-file targets) A program can update itself by replacing its executable file with a new version.

It provides the flexibility to implement different updating user experiences like auto-updating, or manual user-initiated updates. It also boasts advanced features like binary patching and code signing verification.

Example of updating from a URL:

import (
    "fmt"
    "net/http"

    "github.com/minio/selfupdate"
)

func doUpdate(url string) error {
    resp, err := http.Get(url)
    if err != nil {
        return err
    }
    defer resp.Body.Close()
    err := selfupdate.Apply(resp.Body, update.Options{})
    if err != nil {
        // error handling
    }
    return err
}

Features

  • Cross platform support (Windows too!)
  • Binary patch application
  • Checksum verification
  • Code signing verification
  • Support for updating arbitrary files

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information. Original work was also distributed under the same license.

# Functions

Apply performs an update of the current executable or opts.TargetFile, with the contents of the given io.Reader.
CommitBinary moves the new executable to the location of the current executable or opts.TargetPath if specified.
NewBSDifferPatcher returns a new Patcher that applies binary patches using the bsdiff algorithm.
No description provided by the author
PrepareAndCheckBinary reads the new binary content from io.Reader and performs the following actions: 1.
RollbackError takes an error value returned by Apply and returns the error, if any, that occurred when attempting to roll back from a failed update.

# Structs

No description provided by the author
No description provided by the author

# Interfaces

Patcher defines an interface for applying binary patches to an old item to get an updated item.