Skip to content

Commit 20dc921

Browse files
committed
Fix port logic in NewFromURL
1 parent a4bec12 commit 20dc921

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: client.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,8 @@ func NewFromURL(rawURL string) (*Client, error) {
8080
addr = u.Host
8181
}
8282

83-
if !isUnixSocket {
84-
if u.Port() != "" {
85-
addr = net.JoinHostPort(addr, u.Port())
86-
} else {
87-
addr = net.JoinHostPort(addr, "6379")
88-
}
83+
if !isUnixSocket && u.Port() == "" {
84+
addr = net.JoinHostPort(addr, "6379")
8985
}
9086

9187
switch u.Scheme {

0 commit comments

Comments
 (0)