net/netip: disagrees with net.ParseIP on v4on6 #50844
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
net/netip.Addr
obtained via strings, vs. from slices don't compare as expected.https://go.dev/play/p/Bsrg-fO6eRk?v=gotip
I think the issue boils down to
net.ParseIP
always essentially returning whatnet/netip.Addr
would consider av4on6
for IPv4 addresses. The workaround is to bypass net.ParseIP. I'm not sure if it's expected that ip and netip should differ here, and whether it would be breaking compatibility guarantees for ParseIP to return a 4 byte slice for a dotted address string. Perhaps there should be some kind of conversion function/method to smooth the disagreement over?The text was updated successfully, but these errors were encountered: