From 5b65c99b0e77bf8719bf7e203371a7336ddc2a2f Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Thu, 27 Aug 2026 17:08:51 +0300 Subject: [PATCH] fix(server): build ping address with net.JoinHostPort for IPv6 hosts fmt.Sprintf("%s:%d", host, port) produces a malformed address for IPv6 literal hosts (go vet: "address format does not work with IPv6"). Co-Authored-By: Claude Sonnet 5 --- internal/server/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/server/handlers.go b/internal/server/handlers.go index a32e784..d045b7e 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -1695,7 +1695,7 @@ func (s *Server) handleCollectStart(w http.ResponseWriter, r *http.Request) { // pingHost dials host:port up to total times with 2s timeout each, returns true if // at least need attempts succeeded. func pingHost(host string, port int, total, need int) (bool, string) { - addr := fmt.Sprintf("%s:%d", host, port) + addr := net.JoinHostPort(host, strconv.Itoa(port)) var successes atomic.Int32 done := make(chan struct{}, total) for i := 0; i < total; i++ {