net: bad shadowing in ipsock_posix.go; unhelpful ip.String result #15052
Labels
Milestone
Comments
CC @mikioh |
Would it make sense to change the name and replace it with something like Addr: fmt.Sprintf("%v", origIP) That will print the IP as a byte array, which is probably the right thing to do rather than have ip.String() return an invalid ip representation? |
CL https://golang.org/cl/21642 mentions this issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
On tip, the file net/ipsock_posix.go has these lines
It's pretty clear here that the
ip.String
stored inAddrError
is using the wrongip
. This code will always set theAddr
field to"<nil>"
.The same error occurs a few lines down using
To16
.I would send in the obvious fix, but the effect would be to change the
Addr
field from"<nil>"
to"?"
, which is only barely an improvement. We probably need to fix these cases in ipsock_posix.go and also fixIP.String
to produce more useful output for an unrecognized length.The text was updated successfully, but these errors were encountered: