This commit is contained in:
Liang Ding 2014-11-05 00:45:07 +08:00
parent 9577f26cba
commit b31f749add
1 changed files with 35 additions and 29 deletions

View File

@ -84,16 +84,24 @@ var rawWide conf
// Exits process if found fatal issues (such as not found $GOPATH), // Exits process if found fatal issues (such as not found $GOPATH),
// Notifies user by notification queue if found warning issues (such as not found gocode). // Notifies user by notification queue if found warning issues (such as not found gocode).
func FixedTimeCheckEnv() { func FixedTimeCheckEnv() {
checkEnv() // check immediately
go func() { go func() {
for _ = range time.Tick(time.Minute * 7) { for _ = range time.Tick(time.Minute * 7) {
checkEnv()
}
}()
}
func checkEnv() {
if "" == os.Getenv("GOPATH") { if "" == os.Getenv("GOPATH") {
glog.Fatal("Not found $GOPATH") glog.Fatal("Not found $GOPATH, please configure it before running Wide")
os.Exit(-1) os.Exit(-1)
} }
if "" == os.Getenv("GOROOT") { if "" == os.Getenv("GOROOT") {
glog.Fatal("Not found $GOROOT") glog.Fatal("Not found $GOROOT, please configure it before running Wide")
os.Exit(-1) os.Exit(-1)
} }
@ -115,8 +123,6 @@ func FixedTimeCheckEnv() {
glog.Warningf("Not found ide_stub [%s]", ide_stub) glog.Warningf("Not found ide_stub [%s]", ide_stub)
} }
}
}()
} }
// FixedTimeSave saves configurations (wide.json) periodically (1 minute). // FixedTimeSave saves configurations (wide.json) periodically (1 minute).