From f20828285e4ac599eff65aecefb928804216dc46 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Wed, 17 Aug 2016 23:06:45 +0300 Subject: [PATCH] error context for main --- main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 8e9b5a4..b18ffe5 100644 --- a/main.go +++ b/main.go @@ -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() }