From 5c8374f72643776c97230cf90d6fe5af07191051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=80=A1=E7=84=B6?= Date: Wed, 1 Jan 2025 22:53:52 +0800 Subject: [PATCH] fix lint --- cmd/gocq/qsign.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/gocq/qsign.go b/cmd/gocq/qsign.go index d39ab99..fbdae00 100644 --- a/cmd/gocq/qsign.go +++ b/cmd/gocq/qsign.go @@ -134,7 +134,7 @@ func isServerAvailable(signServer string) bool { case "ws", "wss": return isWebSocketAvailable(signServer) default: - log.Error("Unsupported protocol: %v", parsedURL.Scheme) + log.Errorf("Unsupported protocol: %v", parsedURL.Scheme) return false } } @@ -149,9 +149,7 @@ func isHTTPAvailable(url string) bool { log.Warnf("HTTP check failed for %v, error: %v", url, err) return false } - defer func(Body io.ReadCloser) { - _ = Body.Close() - }(resp.Body) + _ = resp.Body.Close() if resp.StatusCode == http.StatusOK { // Assuming response body contains JSON with a "code" field @@ -174,9 +172,7 @@ func isWebSocketAvailable(url string) bool { log.Warnf("WebSocket check failed for %v, error: %v", url, err) return false } - defer func(conn *websocket.Conn) { - _ = conn.Close() - }(conn) + _ = conn.Close() // Optionally, you can send a ping or some message to verify further