Add error check when closing

This commit is contained in:
Miguel de la Cruz 2021-09-12 18:28:49 +02:00
parent 4e5e40f6f1
commit 38767a78d3

View file

@ -34,6 +34,9 @@ func main() {
s := <-c
fmt.Printf("Got signal %s, exiting...\n", s)
srv.Close()
if err := srv.Close(); err != nil {
fmt.Fprintf(os.Stderr, "error closing server: %s", err)
os.Exit(1)
}
<-closed
}