1
0
mirror of https://github.com/taigrr/go-selfupdate synced 2025-01-18 04:33:12 -08:00

Merge pull request #18 from goodeggs/force-check

add ForceCheck parameter
This commit is contained in:
Mark 2016-08-04 13:22:36 -07:00 committed by GitHub
commit 83c3c7d653

View File

@ -81,6 +81,7 @@ type Updater struct {
BinURL string // Base URL for full binary downloads.
DiffURL string // Base URL for diff downloads.
Dir string // Directory to store selfupdate state.
ForceCheck bool // Check for update regardless of cktime timestamp
Requester Requester //Optional parameter to override existing http request handler
Info struct {
Version string
@ -117,7 +118,7 @@ func (u *Updater) BackgroundRun() error {
func (u *Updater) wantUpdate() bool {
path := u.getExecRelativeDir(u.Dir + upcktimePath)
if u.CurrentVersion == "dev" || readTime(path).After(time.Now()) {
if u.CurrentVersion == "dev" || (!u.ForceCheck && readTime(path).After(time.Now())) {
return false
}
wait := 24*time.Hour + randDuration(24*time.Hour)