error context for main

This commit is contained in:
Gokcehan 2016-08-17 23:06:45 +03:00
parent 3830a2499d
commit f20828285e

View File

@ -37,7 +37,7 @@ func init() {
if envHost == "" {
host, err := os.Hostname()
if err != nil {
log.Fatal("$HOSTNAME not set")
log.Printf("hostname: %s", err)
}
envHost = host
}
@ -58,7 +58,7 @@ func startServer() {
cmd := exec.Command(os.Args[0], "-server")
err := cmd.Start()
if err != nil {
log.Print(err)
log.Printf("starting server: %s", err)
}
}
@ -73,8 +73,7 @@ func main() {
serve()
} else {
// TODO: check if the socket is working
_, err := os.Stat(gSocketPath)
if err != nil {
if _, err := os.Stat(gSocketPath); os.IsNotExist(err) {
startServer()
}