diff --git a/tests/cmd/pidfd-kill/pidfd-kill.go b/tests/cmd/pidfd-kill/pidfd-kill.go index ea9a9df8d..764fa883a 100644 --- a/tests/cmd/pidfd-kill/pidfd-kill.go +++ b/tests/cmd/pidfd-kill/pidfd-kill.go @@ -99,12 +99,7 @@ func recvPidfd(socketFile string) (*os.File, error) { } defer conn.Close() - unixconn, ok := conn.(*net.UnixConn) - if !ok { - return nil, errors.New("failed to cast to unixconn") - } - - socket, err := unixconn.File() + socket, err := conn.(*net.UnixConn).File() if err != nil { return nil, err } diff --git a/tests/cmd/recvtty/recvtty.go b/tests/cmd/recvtty/recvtty.go index 2c82665ab..5e5720cc5 100644 --- a/tests/cmd/recvtty/recvtty.go +++ b/tests/cmd/recvtty/recvtty.go @@ -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 }