MCPcopy Index your code
hub / github.com/inconshreveable/go-update

github.com/inconshreveable/go-update @main sqlite

repository ↗ · DeepWiki ↗
97 symbols 319 edges 23 files 19 documented · 20%
README

go-update: Build self-updating Go programs godoc reference

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/inconshreveable/go-update"
)

func doUpdate(url string) error {
    resp, err := http.Get(url)
    if err != nil {
        return err
    }
    defer resp.Body.Close()
    err := update.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

equinox.io

equinox.io is a complete ready-to-go updating solution built on top of go-update that provides:

  • Hosted updates
  • Update channels (stable, beta, nightly, ...)
  • Dynamically computed binary diffs
  • Automatic key generation and code
  • Release tooling with proper code signing
  • Update/download metrics

API Compatibility Promises

The master branch of go-update is not guaranteed to have a stable API over time. For any production application, you should vendor your dependency on go-update with a tool like git submodules, gb or govendor.

The go-update package makes the following promises about API compatibility: 1. A list of all API-breaking changes will be documented in this README. 1. go-update will strive for as few API-breaking changes as possible.

API Breaking Changes

  • Sept 3, 2015: The Options struct passed to Apply was changed to be passed by value instead of passed by pointer. Old API at 28de026.
  • Aug 9, 2015: 2.0 API. Old API at 221d034 or gopkg.in/inconshreveable/go-update.v0.

License

Apache

Extension points exported contracts — how you extend this code

Patcher (Interface)
Patcher defines an interface for applying binary patches to an old item to get an updated item.
patcher.go
Verifier (Interface)
Verifier defines an interface for verfiying an update's signature with a public key.
verifier.go

Core symbols most depended-on inside this repo

Close
called by 19
internal/binarydist/bzip2.go
Apply
called by 15
apply.go
Write
called by 12
internal/binarydist/seek.go
Seek
called by 11
internal/binarydist/seek.go
SetPublicKeyPEM
called by 6
apply.go
Executable
called by 6
internal/osext/osext.go
swap
called by 4
internal/binarydist/diff.go
NewBSDiffPatcher
called by 3
patcher.go

Shape

Function 65
Method 21
Struct 7
FuncType 2
Interface 2

Languages

Go100%

Modules by API surface

apply_test.go21 symbols
apply.go11 symbols
verifier.go8 symbols
internal/osext/osext_test.go8 symbols
internal/binarydist/encoding.go8 symbols
internal/binarydist/diff.go8 symbols
patcher.go5 symbols
internal/binarydist/common_test.go4 symbols
internal/binarydist/bzip2.go4 symbols
internal/binarydist/seek.go3 symbols
internal/osext/osext_windows.go2 symbols
internal/osext/osext_sysctl.go2 symbols

Used by 3 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add go-update \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact