Comments (6)
I just looked at the updated example code in the description and it looks like we can get a nil
result. I'm not sure if it's idiomatic to return a nil result without an error. Is it possible to update to provide an error in these cases so we can check for that instead of a nil result?
from geo-golang.
Hi, this was one of the proposed changes in #29 (have a look at the list at the bottom). One of the points being that no results shouldn't be an error. Have a go yourself and try one of the providers, which return an error (few of them do, not all though) and send a request with the same vector directly to see that they also don't return an error. Thus the proposal to return a pointer to the structure instead of zero value to be able to distinguish no result cases. So returning nil, nil
implies that no results have been found. To finish off, I'd claim that returning a nil pointer is idiomatic go - similar to returning... say null
in Java.
from geo-golang.
ok makes sense, will update accordingly.
from geo-golang.
I'm using github.com/codingsince1985/geo-golang/google
package and it is also may returns nil result with no error
addr, err := geoCoder.ReverseGeocode(lt, lg)
from geo-golang.
@varentsov, what's the lat, lng?
from geo-golang.
lat=51.729729729729726, lng=55.06887992842546
lat=5, lng=0
from geo-golang.
Related Issues (20)
- Panic at geo-golang/mapquest/open/geocoder.go:46 HOT 4
- ReverseGeocode should return an Address struct instead of a string HOT 1
- Chained Geocoder doesn't indicate which provider was used HOT 2
- Geocode should also return accuracy data HOT 2
- function openstreetmap.Geocode panics for no results query HOT 3
- How to include the `_type` property returned by OpenCage in the returned `Address` struct? HOT 1
- Mapbox reverse geocoder errors our on certain points due to literal number as `address` HOT 2
- Interface Cache in the cachedGeocoder HOT 1
- Moving towards go modules HOT 1
- Geocode should not return a nil location and a nil error HOT 1
- osm.Address struct doesn't have `hamlet` field. HOT 1
- Package returns abbreviations for city/state instead of full name
- Create new release tag HOT 1
- How to find details for an address? HOT 2
- running in the browser? HOT 2
- Could not set google region and language query parameters
- Adding context to Geocoder interface HOT 1
- Compiler errors related to io package
- Support for context, plus code address HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geo-golang.