Use errors.Is to compare ErrServerClosed in main
This commit is contained in:
parent
7e377f550c
commit
22ee6343e2
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -29,7 +30,7 @@ func main() {
|
|||
|
||||
go func() {
|
||||
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)
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Reference in New Issue