diff --git a/cmd/merp/main.go b/cmd/merp/main.go index 4fced82..e86d44a 100644 --- a/cmd/merp/main.go +++ b/cmd/merp/main.go @@ -26,11 +26,14 @@ func main() { wg.Add(1) go func() { ms := merp.NewMerpServer() + log.Info().Msg("calling serveforever") ms.ServeForever() + log.Info().Msg("back from serveforever") wg.Done() }() wg.Wait() + log.Info().Msg("done waiting on waitgroup") } func identify() { diff --git a/server.go b/server.go index 1267836..2663dde 100644 --- a/server.go +++ b/server.go @@ -55,7 +55,7 @@ func (ms *MerpServer) init() { ms.setupRoutes() ms.server = &http.Server{ - Addr: fmt.Sprintf(":%s", ms.port), + Addr: fmt.Sprintf(":%d", ms.port), Handler: ms.gin, ReadTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second, @@ -69,7 +69,10 @@ func (ms *MerpServer) connectDB() { // ServeForever causes merp to serve http forever func (ms *MerpServer) ServeForever() { - ms.server.ListenAndServe() + err := ms.server.ListenAndServe() + if err != nil { + panic(err) + } } func (ms *MerpServer) HealthCheckHandler() http.HandlerFunc {