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

*Reader.City returns the zero value if not found #32

Open
celrenheit opened this issue Aug 23, 2017 · 1 comment
Open

*Reader.City returns the zero value if not found #32

celrenheit opened this issue Aug 23, 2017 · 1 comment

Comments

@celrenheit
Copy link

Hello,

The methods City() and Country should return nil if it finds nothing.

The current behavior is that is returns the zero value: https://github.com/oschwald/geoip2-golang/blob/master/reader.go#L240.

In this case, we have to check if city.GeonameID == 0 to know that it is not found.

Wouldn't it be better to return nil instead ?

@oschwald
Copy link
Owner

oschwald commented Aug 23, 2017

This would be a breaking change. I would recommend using maxminddb directly if you want more control over this.

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

No branches or pull requests

2 participants