twitch: dont panic(err), use log - twitch-go - twitch.tv web application in Go | |
git clone git://git.codemadness.org/twitch-go | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bb284c4fa7bbe511d58c55cb7b317462638550b6 | |
parent 3a9ba3f6a4a7193f509542eff2f1db956f446ce9 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 26 Jul 2015 12:18:23 +0200 | |
twitch: dont panic(err), use log | |
Diffstat: | |
M main.go | 13 +++++++------ | |
1 file changed, 7 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/main.go b/main.go | |
@@ -7,6 +7,7 @@ import ( | |
"html/template" | |
"io" | |
"io/ioutil" | |
+ "log" | |
"net" | |
"net/http" | |
"os" | |
@@ -157,21 +158,21 @@ func main() { | |
l, err := net.Listen(config_addrtype, config_addr) | |
if err != nil { | |
- panic(err) | |
+ log.Fatalln(err) | |
} | |
// Set permission on UDS. | |
if config_addrtype == "unix" { | |
err = os.Chmod(config_addr, os.FileMode(config_chmod)) | |
if err != nil { | |
- panic(err) | |
+ log.Fatalln(err) | |
} | |
} | |
if config_datadir != "" { | |
err = os.Chdir(config_datadir) | |
if err != nil { | |
- panic(err) | |
+ log.Fatalln(err) | |
} | |
} | |
@@ -179,7 +180,7 @@ func main() { | |
if config_pidfile != "" { | |
pid := os.Getpid() | |
if err = ioutil.WriteFile(config_pidfile, []byte(fmt.Sprintf("… | |
- panic(err) | |
+ log.Fatalln(err) | |
} | |
} | |
@@ -211,11 +212,11 @@ func main() { | |
// Parse templates and keep in-memory. | |
err = templates.LoadPages(config_templatepagedir) | |
if err != nil { | |
- panic(err) | |
+ log.Fatalln(err) | |
} | |
err = templates.LoadThemes(config_templatethemedir) | |
if err != nil { | |
- panic(err) | |
+ log.Fatalln(err) | |
} | |
http.HandleFunc("/featured", MakeHandler(FeaturedHandler)) |