google / open-location-code

Open Location Code is a library to generate short codes, called "plus codes", that can be used as digital addresses where street addresses don't exist.
https://plus.codes
Apache License 2.0
4.1k stars 475 forks source link

Go : why second normalization ? #376

Closed kpym closed 4 years ago

kpym commented 4 years ago

In encode.go it looks like the longitude is normalized twice :

Is this normal ?

zongweil commented 4 years ago

Thanks for bringing this up @kpym. You're right that the second normalization check is unnecessary, since lng will never equal lngMax after the first normalizeLongitude() call.

Feel free to send a PR if you'd like :). Otherwise, I can fix it later.