From ac86b6bfe80fb7103ba5bce0ae4fffa0b3798e48 Mon Sep 17 00:00:00 2001 From: novenary Date: Wed, 11 Dec 2024 21:10:37 +0000 Subject: [PATCH] Don't exit when removing socket fails Prior to migrating to slog, errors when removing the socket were ignored. This is fine and desirable: the most likely error condition is that the socket did not exist in the first place. Exiting on error in that case effectively prevents Mycorrhiza to be used with unix sockets. If the removal fails for another reason, then starting the server will fail, so logging a warning is sufficient for troubleshooting. --- httpd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpd.go b/httpd.go index 71bf815..b838e40 100644 --- a/httpd.go +++ b/httpd.go @@ -32,7 +32,7 @@ func serveHTTP(handler http.Handler) (err error) { func startUnixSocketServer(server *http.Server, socketPath string) error { err := os.Remove(socketPath) if err != nil { - return err + slog.Warn("Failed to clean up old socket", "err", err) } listener, err := net.Listen("unix", socketPath)