Skip to content

gwillem/go-selfupdate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang self-update from URL

Runs a cheap auto-update using Last-Modified-If header, so only downloads when a newer version is available (based on modification timestamp of the current executable).

import (
    "fmt"
    "github.com/gwillem/go-selfupdate"
)

var updateURL = "https://yoursite/gobinary"

func main() {
    if ok, _ := selfupdate.UpdateRestart(updateURL); ok {
        fmt.Println("New version reporting!")
    }
}

Because UpdateRestart will replace the current process, you should run at the beginning of your code (such as in init()).

About

Auto-updater for Golang programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages