From 3497f58b05842f31c0e8515ffc7158976e40a8ca Mon Sep 17 00:00:00 2001 From: Matteo Suppo Date: Mon, 11 Apr 2016 11:08:40 +0200 Subject: [PATCH 1/2] Allow update for dev --- updater/updater.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/updater/updater.go b/updater/updater.go index 239dc20d5..bcc4f6b40 100644 --- a/updater/updater.go +++ b/updater/updater.go @@ -12,13 +12,12 @@ import ( "os" "path/filepath" "runtime" - "strings" "time" log "github.com/Sirupsen/logrus" + "github.com/inconshreveable/go-update" "github.com/kr/binarydist" - "github.com/inconshreveable/go-update" "github.com/kardianos/osext" ) @@ -257,8 +256,8 @@ func (u *Updater) update() error { } func (u *Updater) wantUpdate() bool { - if strings.Contains(u.CurrentVersion, "dev") { - return false - } + // if strings.Contains(u.CurrentVersion, "dev") { + // return false + // } return true } From 82a4b4ef401210dd4ec2df34b5bb6da360286d70 Mon Sep 17 00:00:00 2001 From: Matteo Suppo Date: Mon, 11 Apr 2016 15:31:01 +0200 Subject: [PATCH 2/2] Remove useless function --- updater/updater.go | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/updater/updater.go b/updater/updater.go index bcc4f6b40..a1d389b49 100644 --- a/updater/updater.go +++ b/updater/updater.go @@ -89,22 +89,20 @@ type Updater struct { // BackgroundRun starts the update check and apply cycle. func (u *Updater) BackgroundRun() error { os.MkdirAll(u.getExecRelativeDir(u.Dir), 0777) - if u.wantUpdate() { - if err := up.CanUpdate(); err != nil { - log.Println(err) - return err - } - //self, err := osext.Executable() - //if err != nil { - // fail update, couldn't figure out path to self - //return - //} - // TODO(bgentry): logger isn't on Windows. Replace w/ proper error reports. - if err := u.update(); err != nil { - return err - } + if err := up.CanUpdate(); err != nil { + log.Println(err) + return err } - return errors.New("Won't update because it's a development daemon. Change the version in main.go") + //self, err := osext.Executable() + //if err != nil { + // fail update, couldn't figure out path to self + //return + //} + // TODO(bgentry): logger isn't on Windows. Replace w/ proper error reports. + if err := u.update(); err != nil { + return err + } + return nil } func fetch(url string) (io.ReadCloser, error) { @@ -254,10 +252,3 @@ func (u *Updater) update() error { return nil } - -func (u *Updater) wantUpdate() bool { - // if strings.Contains(u.CurrentVersion, "dev") { - // return false - // } - return true -}