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