Giter VIP home page Giter VIP logo

Comments (6)

saheljalal avatar saheljalal commented on May 22, 2024

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.

kruftmeister avatar kruftmeister commented on May 22, 2024

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.

saheljalal avatar saheljalal commented on May 22, 2024

ok makes sense, will update accordingly.

from geo-golang.

varentsov avatar varentsov commented on May 22, 2024

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.

codingsince1985 avatar codingsince1985 commented on May 22, 2024

@varentsov, what's the lat, lng?

from geo-golang.

varentsov avatar varentsov commented on May 22, 2024
lat=51.729729729729726, lng=55.06887992842546
lat=5, lng=0

from geo-golang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.