From c7b0a4a81827284f7565c56aa476eea34fb6382f Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Mon, 23 Dec 2019 14:43:47 +0300 Subject: - test fixes --- util/network.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'util/network.go') diff --git a/util/network.go b/util/network.go index 70e38fdb..3f533023 100644 --- a/util/network.go +++ b/util/network.go @@ -2,6 +2,7 @@ package util import ( "errors" + "fmt" "net" "strings" "syscall" @@ -11,15 +12,18 @@ import ( func CreateListener(address string) (net.Listener, error) { dsn := strings.Split(address, "://") if len(dsn) != 2 { - return nil, errors.New("Invalid DSN (tcp://:6001, unix://file.sock)") + return nil, errors.New("invalid DSN (tcp://:6001, unix://file.sock)") } if dsn[0] != "unix" && dsn[0] != "tcp" { - return nil, errors.New("Invalid Protocol (tcp://:6001, unix://file.sock)") + return nil, errors.New("invalid Protocol (tcp://:6001, unix://file.sock)") } if dsn[0] == "unix" { - syscall.Unlink(dsn[1]) + err := syscall.Unlink(dsn[1]) + if err != nil { + return nil, fmt.Errorf("error during the unlink syscall: error %v", err) + } } return net.Listen(dsn[0], dsn[1]) -- cgit v1.2.3