| | |
| | | // Package update provides tooling to auto-update binary releases |
| | | // package goupdate provides tooling to auto-update binary releases |
| | | // from GitHub based on the user's current version and operating system. |
| | | package update |
| | | package goupdate |
| | | |
| | | import ( |
| | | "fmt" |
| | |
| | | "io/ioutil" |
| | | "net/http" |
| | | "os" |
| | | "os/exec" |
| | | "path/filepath" |
| | | "runtime" |
| | | "strconv" |
| | |
| | | return errors.Wrap(err, "opening tarball") |
| | | } |
| | | |
| | | err = unpackit.Unpack(f, "") |
| | | err = unpackit.Unpack(f, dir) |
| | | if err != nil { |
| | | f.Close() |
| | | return errors.Wrap(err, "unpacking tarball") |
| | |
| | | |
| | | // Install binary to replace the current version. |
| | | func (m *Manager) Install(path string) error { |
| | | bin, err := os.Executable() |
| | | bin, err := exec.LookPath("./" + m.Command) |
| | | if err != nil { |
| | | return errors.Wrapf(err, "looking up path of %q", m.Command) |
| | | } |