why the (*joinError) panic? i even can’t create a nil *joinError.
go 1.23.4
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xfb44180]
goroutine 5505 [running]:
errors.(*joinError).Unwrap(0x116c8aa0?)
errors/join.go:61
errors.as({0x10d749e0?, 0x0?}, {0x10af6a20, 0xc002ca20a0}, {0x10af6a20?, 0xc002ca20a0?, 0xc0014794f0?}, {0x10d91190, 0x10bf7ca0})
errors/wrap.go:132 +0x325
errors.As({0x10d749e0, 0x0}, {0x10af6a20, 0xc002ca20a0})
errors/wrap.go:113 +0x1c8
github.com/Asutorufa/yuhaiin/pkg/net/dialer.MergeDnsError({0x10d749e0, 0x0}, {0x10d736a0, 0xc00117c220})
github.com/Asutorufa/yuhaiin/pkg/net/dialer/happyeyeballsv2.go:138 +0xa6
github.com/Asutorufa/yuhaiin/pkg/net/dialer.(*happyEyeball).lookupIP(0xc00105c000, {0x10d85fc0, 0xc0011b2000}, 0x1)
github.com/Asutorufa/yuhaiin/pkg/net/dialer/happyeyeballsv2.go:117 +0x19a
created by github.com/Asutorufa/yuhaiin/pkg/net/dialer.(*HappyEyeballsv2Dialer[...]).DialHappyEyeballsv2 in goroutine 5503
github.com/Asutorufa/yuhaiin/pkg/net/dialer/happyeyeballsv2.go:273 +0x372
the MergeDnsError is, I want remove same dns error.
func MergeDnsError(err1, err2 error) error {
de1 := &net.DNSError{}
if !errors.As(err1, &de1) {
return errors.Join(err1, err2)
}
de2 := &net.DNSError{}
if !errors.As(err2, &de2) {
return errors.Join(err1, err2)
}
if de1.Err == de2.Err {
return err1
}
return errors.Join(err1, err2)
}
I tried erros.Join(nil,nil)
, but not panic.
New contributor
Asutorufa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1