tests/cmd: simplify getting net.UnixConn

The typecast can't fail, so it doesn't make sense checking for errors
here.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-07-28 16:57:03 -07:00
parent 87b8f974c8
commit 314dd812f5
2 changed files with 3 additions and 20 deletions
+2 -14
View File
@@ -85,13 +85,7 @@ func handleSingle(path string, noStdin bool) error {
// Close ln, to allow for other instances to take over.
ln.Close()
// Get the fd of the connection.
unixconn, ok := conn.(*net.UnixConn)
if !ok {
return errors.New("failed to cast to unixconn")
}
socket, err := unixconn.File()
socket, err := conn.(*net.UnixConn).File()
if err != nil {
return err
}
@@ -158,13 +152,7 @@ func handleNull(path string) error {
// Don't leave references lying around.
defer conn.Close()
// Get the fd of the connection.
unixconn, ok := conn.(*net.UnixConn)
if !ok {
return
}
socket, err := unixconn.File()
socket, err := conn.(*net.UnixConn).File()
if err != nil {
return
}