diff --git a/sockets/unix_socket.go b/sockets/unix_socket.go index 1d91c7b6c..0df5f8201 100644 --- a/sockets/unix_socket.go +++ b/sockets/unix_socket.go @@ -79,7 +79,7 @@ func WithChmod(mask os.FileMode) SockOption { // NewUnixSocketWithOpts creates a unix socket with the specified options func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error) { - if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { return nil, err } mask := syscall.Umask(0777)