CellId.AllNeighbors has documented but unchecked precondition
ll1 := s2.LatLngFromDegrees(30.755702, 114.127656) c1 := s2.CellIDFromLatLng(ll1) neighbors := c1.AllNeighbors(8)
Can you put this in the form of a test case we can add to latlng_test.go?
c1 is level 30. You can't get level 8 neighbors from that.
https://github.com/golang/geo/blob/dc45a1002b836666a1af4fffedca3220ba59d03c/s2/cellid.go#L271
You can try c1 := s2.CellIDFromLatLng(ll1).Parent(8).
@rsned Apparently go has no assert / DCHECK. Should this also return an ok bool? There must be many more examples of unchecked preconditions waiting to bite someone and waste time.
It is possible to set up a dcheck equivalent using go build tags. e.g. https://github.com/golang/geo/pull/141. There are a couple places where I noted the c++ checks something here, but not too many of the DCHECKs are directly referenced in the code.