chore: linter: errorlint

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2025-10-23 22:48:54 +02:00
parent 7c9d06b4d2
commit 8e796ddb94
14 changed files with 31 additions and 17 deletions
+3 -1
View File
@@ -7,6 +7,7 @@
package connections
import (
"errors"
"net"
"net/url"
"strconv"
@@ -20,7 +21,8 @@ func fixupPort(uri *url.URL, defaultPort int) *url.URL {
copyURI := *uri
host, port, err := net.SplitHostPort(uri.Host)
if e, ok := err.(*net.AddrError); ok && strings.Contains(e.Err, "missing port") {
e := &net.AddrError{}
if errors.As(err, &e) && strings.Contains(e.Err, "missing port") {
// addr is of the form "1.2.3.4" or "[fe80::1]"
host = uri.Host
if strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]") {