From b8bf9995ca90ec234231879db7142d3039b8a592 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Sun, 9 Jun 2019 19:00:06 +0100 Subject: [PATCH] Log messages when server exits --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 4df7442..bb4e2ae 100644 --- a/main.go +++ b/main.go @@ -8,11 +8,14 @@ import ( func main() { fs := http.FileServer(http.Dir("./html")) log.Print("Serving on http://localhost:8080") - http.ListenAndServe(":8080", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { + err := http.ListenAndServe(":8080", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { if req.URL.Path == "/test.wasm" { resp.Header().Set("content-type", "application/wasm") } fs.ServeHTTP(resp, req) })) + if err != http.ErrServerClosed { + log.Fatal(err) + } }