Fix #130
This commit is contained in:
parent
9577f26cba
commit
b31f749add
64
conf/wide.go
64
conf/wide.go
|
@ -84,41 +84,47 @@ 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) {
|
||||||
if "" == os.Getenv("GOPATH") {
|
checkEnv()
|
||||||
glog.Fatal("Not found $GOPATH")
|
|
||||||
|
|
||||||
os.Exit(-1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if "" == os.Getenv("GOROOT") {
|
|
||||||
glog.Fatal("Not found $GOROOT")
|
|
||||||
|
|
||||||
os.Exit(-1)
|
|
||||||
}
|
|
||||||
|
|
||||||
gocode := Wide.GetExecutableInGOBIN("gocode")
|
|
||||||
cmd := exec.Command(gocode, "close")
|
|
||||||
_, err := cmd.Output()
|
|
||||||
if nil != err {
|
|
||||||
event.EventQueue <- &event.Event{Code: event.EvtCodeGocodeNotFound}
|
|
||||||
|
|
||||||
glog.Warningf("Not found gocode [%s]", gocode)
|
|
||||||
}
|
|
||||||
|
|
||||||
ide_stub := Wide.GetExecutableInGOBIN("ide_stub")
|
|
||||||
cmd = exec.Command(ide_stub, "version")
|
|
||||||
_, err = cmd.Output()
|
|
||||||
if nil != err {
|
|
||||||
event.EventQueue <- &event.Event{Code: event.EvtCodeIDEStubNotFound}
|
|
||||||
|
|
||||||
glog.Warningf("Not found ide_stub [%s]", ide_stub)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkEnv() {
|
||||||
|
if "" == os.Getenv("GOPATH") {
|
||||||
|
glog.Fatal("Not found $GOPATH, please configure it before running Wide")
|
||||||
|
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if "" == os.Getenv("GOROOT") {
|
||||||
|
glog.Fatal("Not found $GOROOT, please configure it before running Wide")
|
||||||
|
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
gocode := Wide.GetExecutableInGOBIN("gocode")
|
||||||
|
cmd := exec.Command(gocode, "close")
|
||||||
|
_, err := cmd.Output()
|
||||||
|
if nil != err {
|
||||||
|
event.EventQueue <- &event.Event{Code: event.EvtCodeGocodeNotFound}
|
||||||
|
|
||||||
|
glog.Warningf("Not found gocode [%s]", gocode)
|
||||||
|
}
|
||||||
|
|
||||||
|
ide_stub := Wide.GetExecutableInGOBIN("ide_stub")
|
||||||
|
cmd = exec.Command(ide_stub, "version")
|
||||||
|
_, err = cmd.Output()
|
||||||
|
if nil != err {
|
||||||
|
event.EventQueue <- &event.Event{Code: event.EvtCodeIDEStubNotFound}
|
||||||
|
|
||||||
|
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).
|
||||||
//
|
//
|
||||||
// Main goal of this function is to save user session content, for restoring session content while user open Wide next time.
|
// Main goal of this function is to save user session content, for restoring session content while user open Wide next time.
|
||||||
|
|
Loading…
Reference in New Issue