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: comments preceding IP.String should reflect RFC 5952 conformance status #44485

Closed
cameronelliott opened this issue Feb 22, 2021 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@cameronelliott
Copy link

What version of Go are you using (go version)?

go version go1.15.7 darwin/amd64

Does this issue reproduce with the latest release?

Y

The method in src/net/ip.go func (ip IP) String() is supposed to conform to RFC 5952 according to this comment:
#30264 (comment)

The comment is by @mikioh

But, unfortunately, the source-code comments above src/net/ip.go func (ip IP) String() do
not in any way mention that the IPv6 output is supposed to conform to RFC 5952.
RFC 5952 is "A Recommendation for IPv6 Address Text Representation"

If, indeed, -> src/net/ip.go func (ip IP) String() should conform to RFC 5952 for IPv6 addresses,
could the comments preceding the method be changed?

I would be happy to submit a PR if it is deemed:

  1. True that src/net/ip.go func (ip IP) String() does (shall) need to conform to RFC 5952
  2. The comment explaining this is useful to others.

The reason this is valuable, is some developers need to store, and then compare the ASCII representations of
IPv6 addresses.
A developer presented with the issue of needing to compare ASCII representations is then presented with the
issue of how to normalize the ASCII representation, so that systems, such as databases can use a uniform
method of representing the IPv6 addresses. This is important so that addresses which are truly equal are also
recognized when comparing the ASCII representation.
"stuff needs to work correctly, as expected when storing & comparing IPv6 addresses"

@ianlancetaylor ianlancetaylor changed the title Comments preceding src/net/ip.go func (ip IP) String() should reflect RFC 5952 conformance status net: comments preceding IP.String should reflect RFC 5952 conformance status Feb 22, 2021
@ianlancetaylor ianlancetaylor added help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 22, 2021
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Feb 22, 2021
@gopherbot
Copy link

Change https://golang.org/cl/337369 mentions this issue: net: update comments preceding IP.String to reflect RFC 5952 conformance status

@gopherbot
Copy link

Change https://golang.org/cl/337290 mentions this issue: doc/ip: comments preceding IP.String reflect RFC 5952 conformance

@gopherbot
Copy link

Change https://golang.org/cl/337409 mentions this issue: net: comments preceding IP.String to reflect RFC 5952 conformance

@neild
Copy link
Contributor

neild commented Aug 5, 2021

I think that it's reasonable to document IP.String as producing RFC 5952-conforming strings. This constrains our ability to change it in the future, but a) it seems unlikely that it would be practical for us to do so, b) it seems unlikely that RFC 5952 will be superseded by a new canonical string representation for IPv6 addresses, and c) the benefit of providing a supported RFC-compliant canonical textual representation outweighs the constraint on future changes to this function.

hitzhangjie added a commit to hitzhangjie/go that referenced this issue Aug 6, 2021
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 13, 2021
@dmitshur dmitshur modified the milestones: Backlog, Go1.18 Aug 13, 2021
@golang golang locked and limited conversation to collaborators Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
5 participants