From c42f56b3a1e505db02f8057dbdda1a90fbe53d75 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Mon, 25 Sep 2017 09:30:09 -0700 Subject: [PATCH] Move unix specific tidbits into dialer_unix.go Signed-off-by: Kenfe-Mickael Laventure --- dialer.go | 4 +--- dialer_unix.go | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dialer.go b/dialer.go index 0e54ebae1..1c29968aa 100644 --- a/dialer.go +++ b/dialer.go @@ -2,7 +2,6 @@ package containerd import ( "net" - "strings" "time" "github.com/pkg/errors" @@ -18,7 +17,6 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) { stopC = make(chan struct{}) synC = make(chan *dialResult) ) - address = strings.TrimPrefix(address, "unix://") go func() { defer close(synC) for { @@ -47,6 +45,6 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) { dr.c.Close() } }() - return nil, errors.Errorf("dial %s: no such file or directory", address) + return nil, errors.Errorf("dial %s: timeout", address) } } diff --git a/dialer_unix.go b/dialer_unix.go index 3c4689986..3a37d5b56 100644 --- a/dialer_unix.go +++ b/dialer_unix.go @@ -6,6 +6,7 @@ import ( "fmt" "net" "os" + "strings" "syscall" "time" ) @@ -24,6 +25,7 @@ func isNoent(err error) bool { } func dialer(address string, timeout time.Duration) (net.Conn, error) { + address = strings.TrimPrefix(address, "unix://") return net.DialTimeout("unix", address, timeout) }