Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: IPNet only converts to string properly if it is a pointer #8575

Closed
gopherbot opened this issue Aug 23, 2014 · 5 comments
Closed

net: IPNet only converts to string properly if it is a pointer #8575

gopherbot opened this issue Aug 23, 2014 · 5 comments

Comments

@gopherbot
Copy link

by vishvananda:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What does 'go version' print?

go version go1.2 linux/amd64

What steps reproduce the problem?

Example: http://play.golang.org/p/MbDKbO3Fbe


What happened?

IPNet prints as  {127.0.0.1 ffffffff}
&ipnet: 127.0.0.1/32

What should have happened instead?

IPNet should print as  127.0.0.1/32

Please provide any additional information below.
@gopherbot
Copy link
Author

Comment 1:

CL https://golang.org/cl/128650043 mentions this issue.

@minux
Copy link
Member

minux commented Aug 23, 2014

Comment 2:

String method is only defined on pointer receiver, so this is WAI.
Go 1 API guarantee means we can't do anything about this.

Status changed to WorkingAsIntended.

@gopherbot
Copy link
Author

Comment 3 by vishvananda:

well that is too bad. Can we add an additional method that works on non-pointers? This
seems like an oversight. Fyi the changed method still works on pointers as well so I
don't know how it would be functionally different from adding another method.

@minux
Copy link
Member

minux commented Aug 23, 2014

Comment 4:

it might be an oversight, but how could we add another
method for non-pointer receivers?

@gopherbot
Copy link
Author

Comment 5 by vishvananda:

Yes I tried and found out you can't define both. Ok definitely should be closed. Thanks
for your help.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants