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

Docs on LookupHost don't match usage #5

Open
chillum opened this issue Sep 1, 2018 · 2 comments
Open

Docs on LookupHost don't match usage #5

chillum opened this issue Sep 1, 2018 · 2 comments

Comments

@chillum
Copy link

chillum commented Sep 1, 2018

This example from Readme does not work:

resolver := &dnscache.Resolver{}

// First call will cache the result
addrs, err := resolver.LookupHost("example.com")

This does (taken from tests, not sure if that's the correct context for me):

resolver := &dnscache.Resolver{}
addrs, err := resolver.LookupHost(context.Background(), "example.com")

It would be great, we'd have correct docs. I can submit the PR, but not sure about what context it should be.

@rs
Copy link
Owner

rs commented Sep 1, 2018

The context can be background if you don’t want timeout or a context with timeout if you want timeout or be able to cancel.

@chillum
Copy link
Author

chillum commented Sep 1, 2018

okay, submitted a patch in my branch: #4
those docs seem to be broken since existing of the program, if I read the commit history correctly, btw

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

No branches or pull requests

2 participants