diff --git a/internal/server/server.go b/internal/server/server.go index 525992e..6008fad 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -7,7 +7,7 @@ import ( "github.com/gin-gonic/gin" ) -func Launch(port int, indent int, char string, fn func(s string, indent int, char string) (string, error)) { +func Launch(port int, indent int, char string, fn func(s string, indent int, char string) (string, error)) error { gin.SetMode(gin.ReleaseMode) router := gin.Default() @@ -29,5 +29,5 @@ func Launch(port int, indent int, char string, fn func(s string, indent int, cha c.Data(http.StatusOK, "text/javascript", CACHE_SCRIPT) }) - router.Run(fmt.Sprintf(":%d", port)) + return router.Run(fmt.Sprintf(":%d", port)) } diff --git a/main.go b/main.go index f9f321b..78580dd 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,10 @@ func main() { src, dest, indent, char, web, port := cmd.InitArgv() if web { - server.Launch(port, indent, char, formatter.Formatter) + err := server.Launch(port, indent, char, formatter.Formatter) + if err != nil { + log.Fatal(err) + } } else { err := updater.UpdateConfInDir(src, dest, indent, char, formatter.Formatter) if err != nil {