cleanup: typo and code
This commit is contained in:
@@ -2,6 +2,7 @@ package mux
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -10,7 +11,7 @@ import (
|
||||
|
||||
type ServeCB func(srv *http.Server) error
|
||||
|
||||
// Serve with gracefull shutdown
|
||||
// Serve with graceful shutdown
|
||||
func (r *Router) Serve(cb ServeCB) {
|
||||
srv := &http.Server{
|
||||
Handler: r,
|
||||
@@ -32,7 +33,7 @@ func (r *Router) Serve(cb ServeCB) {
|
||||
close(idleConnsClosed)
|
||||
}()
|
||||
|
||||
if err := cb(srv); err != http.ErrServerClosed {
|
||||
if err := cb(srv); !errors.Is(err, http.ErrServerClosed) {
|
||||
// Error starting or closing listener:
|
||||
slog.Error("start server error", "error", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user