Use errors.Is to compare ErrServerClosed in main
This commit is contained in:
parent
7e377f550c
commit
22ee6343e2
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -29,7 +30,7 @@ func main() {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Printf("INFO - listening on %s\n", srv.Addr)
|
log.Printf("INFO - listening on %s\n", srv.Addr)
|
||||||
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
|
if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
|
||||||
log.Fatalf("http server: %v", err)
|
log.Fatalf("http server: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue