Check return code of ListenAndServe()

This commit is contained in:
Johannes 'fish' Ziemke 2016-01-28 13:44:40 +01:00
parent e5925db736
commit dedff6a027
1 changed files with 7 additions and 1 deletions

View File

@ -163,7 +163,7 @@ func main() {
RegisterWeb(router)
api.Register(router.WithPrefix("/api"))
go http.ListenAndServe(*listenAddress, router)
go listen(router)
var (
hup = make(chan os.Signal)
@ -227,3 +227,9 @@ func extURL(s string) (*url.URL, error) {
return u, nil
}
func listen(router *route.Router) {
if err := http.ListenAndServe(*listenAddress, router); err != nil {
log.Fatal(err)
}
}