From d1c4088e4620e70bed82ad28d31419fcc686b464 Mon Sep 17 00:00:00 2001 From: Daniel Adam Date: Wed, 1 May 2024 18:53:40 +0200 Subject: [PATCH] fixup! Upgrade dependencies --- net/connUDP_internal_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/net/connUDP_internal_test.go b/net/connUDP_internal_test.go index 5e1cf901..4c610f40 100644 --- a/net/connUDP_internal_test.go +++ b/net/connUDP_internal_test.go @@ -284,21 +284,22 @@ func TestControlMessageString(t *testing.T) { func getIfaceAddr(t *testing.T, iface net.Interface, ipv4 bool) net.IP { addrs, err := iface.Addrs() require.NoError(t, err) + require.NotEmpty(t, addrs) + var ipOut net.IP for _, addr := range addrs { ip, _, err := net.ParseCIDR(addr.String()) require.NoError(t, err) if !ip.IsPrivate() { continue } - if ipv4 { - if ip.To4() != nil { - return ip - } + if ipv4 && ip.To4() == nil { continue } - return ip + ipOut = ip + break } - return nil + require.NotEmpty(t, ipOut) + return ipOut } func TestUDPConnWriteToAddr(t *testing.T) { @@ -306,6 +307,7 @@ func TestUDPConnWriteToAddr(t *testing.T) { require.NoError(t, err) var iface net.Interface for _, i := range ifaces { + t.Logf("interface name:%v, flags: %v", i.Name, i.Flags) if i.Flags&net.FlagUp == net.FlagUp && i.Flags&net.FlagMulticast == net.FlagMulticast && i.Flags&net.FlagLoopback != net.FlagLoopback { iface = i break