getHostPortWithDefaults is a helper function that splits the url into a host and a port. If the host is missing, it defaults to localhost and if the port is missing, it defaults to 6379.
(u *url.URL)
| 547 | // a host and a port. If the host is missing, it defaults to localhost |
| 548 | // and if the port is missing, it defaults to 6379. |
| 549 | func getHostPortWithDefaults(u *url.URL) (string, string) { |
| 550 | host, port, err := net.SplitHostPort(u.Host) |
| 551 | if err != nil { |
| 552 | host = u.Host |
| 553 | } |
| 554 | if host == "" { |
| 555 | host = "localhost" |
| 556 | } |
| 557 | if port == "" { |
| 558 | port = "6379" |
| 559 | } |
| 560 | return host, port |
| 561 | } |
| 562 | |
| 563 | func setupUnixConn(u *url.URL) (*Options, error) { |
| 564 | o := &Options{ |
no outgoing calls
no test coverage detected