Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

fix: check errors.Is instead of strings.Contains for http: Server closed error (#1779)

Muhammed Kadir Tan2afac2469e92
diff --git a/cmd/init.go b/cmd/init.go
index bda3c4ec..a3c5422c 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -4,8 +4,10 @@ import (
"bytes"
"crypto/md5"
"encoding/json"
+ "errors"
"fmt"
"html/template"
+ "net/http"
"os"
"path"
"path/filepath"
@@ -792,7 +794,7 @@ func initHTTPServer(app *App) *echo.Echo {
// Start the server.
go func() {
if err := srv.Start(ko.String("app.address")); err != nil {
- if strings.Contains(err.Error(), "Server closed") {
+ if errors.Is(err, http.ErrServerClosed) {
lo.Println("HTTP server shut down")
} else {
lo.Fatalf("error starting HTTP server: %v", err)