diff options
author | Wolfy-J <[email protected]> | 2019-12-23 14:43:47 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-12-23 14:43:47 +0300 |
commit | c7b0a4a81827284f7565c56aa476eea34fb6382f (patch) | |
tree | ee30e93169c37fb058fbe55af6b3f954eabd9646 /util | |
parent | 7f694966730f6dac09d0d0ea3bf51276b8e4dfe4 (diff) |
- test fixes
Diffstat (limited to 'util')
-rw-r--r-- | util/network.go | 10 |
1 files changed, 7 insertions, 3 deletions
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]) |