Skip to content
Build self-updating Golang programs
Branch: master
Clone or download
inconshreveable Fix nondeterministic failure caused by parallel tests.
Tests no longer run in parallel. Fix a test case that mocked
a global variable mock but never reset it.

One test overrides the `openFile` function to mock a file system
call with a version that always errors. There were two issues with this:

1. The test case never reset openFile to use os.OpenFile
2. The tests could run in parallel which would result in another test case
   calling the mocked version before it could be reset.
Latest commit 8152e7e Jan 12, 2016

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 (


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


  • Cross platform support (Windows too!)
  • Binary patch application
  • Checksum verification
  • Code signing verification
  • Support for updating arbitrary files 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.
  2. 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



You can’t perform that action at this time.