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: Resolver.LookupIP: document should clarify the return values #43506

Open
yegle opened this issue Jan 5, 2021 · 4 comments
Open

net: Resolver.LookupIP: document should clarify the return values #43506

yegle opened this issue Jan 5, 2021 · 4 comments

Comments

@yegle
Copy link

@yegle yegle commented Jan 5, 2021

The current document on net.Resolver.LookupIP was not clear on the return values (i.e. what to expect when err is nil).

Looking into the source code, LookupIP uses internetAddrList here, and the comment for internetAddrList here does state the slice would contain at least one IP when err is nil.

We should duplicate the comment of internetAddrList to LookupIP.

yegle added a commit to yegle/go that referenced this issue Jan 5, 2021
The function will return at least one address when error is nil.

Fixes golang#43506
@gopherbot
Copy link

@gopherbot gopherbot commented Jan 5, 2021

Change https://golang.org/cl/281552 mentions this issue: net: clarify Resolver.LookupIP return values

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 5, 2021

Why is this specific to Resolver.LookupIP? Seems like exactly the same issue arises for LookupHost, Resolver.LookupHost, LookupIP, Resolver.LookupIPAddr, LookupSRV, Resolver.LookupSRV, LookupMX, Resolver.LookupMX, LookupNS, Resolver.LookupNS, LookupTXT, Resolver.LookupTXT, LookupAddr, Resolver.LookupAddr, and possibly others.

@ianlancetaylor ianlancetaylor changed the title net.Resolver.LookupIP: document should clarify the return values net: Resolver.LookupIP: document should clarify the return values Jan 5, 2021
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Jan 5, 2021
@yegle
Copy link
Author

@yegle yegle commented Jan 5, 2021

It might apply to other functions as well, I only encountered this problem when using LookupIP.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 5, 2021

My point is: let's try to find a clean fix for all relevant functions and methods, rather than just fixing one location. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.