containerd/dialer_unix.go
Phil Estes bd1f89b73f Merge pull request #1555 from crosbymichael/client-lint
Update client to pass go lint
2017-09-25 13:26:31 -04:00

37 lines
677 B
Go

// +build !windows
package containerd
import (
"fmt"
"net"
"os"
"strings"
"syscall"
"time"
)
func isNoent(err error) bool {
if err != nil {
if nerr, ok := err.(*net.OpError); ok {
if serr, ok := nerr.Err.(*os.SyscallError); ok {
if serr.Err == syscall.ENOENT {
return true
}
}
}
}
return false
}
func dialer(address string, timeout time.Duration) (net.Conn, error) {
address = strings.TrimPrefix(address, "unix://")
return net.DialTimeout("unix", address, timeout)
}
// DialAddress returns the address with unix:// prepended to the
// provided address
func DialAddress(address string) string {
return fmt.Sprintf("unix://%s", address)
}