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

feat: added error codes #73

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0e3ea80
feat: added error codes
mojixcoder Oct 10, 2024
d6cba0d
feat: add error codes for LatLngToCell function
mojixcoder Oct 10, 2024
7951f80
feat: add error codes for CellToLatLng function
mojixcoder Oct 10, 2024
1ec8c63
feat: add error codes for cellToBoundary function
mojixcoder Oct 10, 2024
c20b289
feat: add tests for getIcosahedronFaces function
mojixcoder Oct 10, 2024
f25e167
feat: add error codes for gridDisk function
mojixcoder Oct 10, 2024
7566a22
feat: add error codes for gridDiskDistances function
mojixcoder Oct 10, 2024
8d6c553
feat: add error codes for gridPathCells function
mojixcoder Oct 10, 2024
7c0f6c1
feat: add error codes for gridDistance function
mojixcoder Oct 10, 2024
b17ff4a
feat: add error codes for cellToLocalIj function
mojixcoder Oct 10, 2024
e44f8eb
feat: add error codes for localIjToCell function
mojixcoder Oct 10, 2024
5c3c3bd
feat: add error codes for cellToParent function
mojixcoder Oct 10, 2024
cb9921d
feat: added error codes for cellToChildren function
mojixcoder Oct 10, 2024
f15bb00
feat: added error codes for cellToCenterChild function
mojixcoder Oct 10, 2024
300bb96
feat: added error codes for cellToChildPos function
mojixcoder Oct 10, 2024
2413df2
feat: added error codes for childPosToCell function
mojixcoder Oct 10, 2024
a74edda
feat: added error codes for compactCells function
mojixcoder Oct 10, 2024
2ad6ef9
feat: add error codes for uncompactCells function
mojixcoder Oct 10, 2024
6763e41
feat: added error codes for polygonToCells function
mojixcoder Oct 10, 2024
a174dcc
feat: added error codes for areNeighborCells function
mojixcoder Oct 10, 2024
840b68d
feat: added error codes for cellsToDirectedEdge function
mojixcoder Oct 10, 2024
11f3c91
feat: added error codes for originToDirectedEdges function
mojixcoder Oct 10, 2024
c497360
feat: added error codes for directedEdgeToBoundary function
mojixcoder Oct 10, 2024
71b067a
feat: added error codes for origin and destination of directed edge
mojixcoder Oct 10, 2024
3695cd8
feat: added error codes for directedEdgeToCells function
mojixcoder Oct 10, 2024
baeba04
feat: added error codes for area functions
mojixcoder Oct 10, 2024
fd8cdfe
feat: add error codes for length functions
mojixcoder Oct 10, 2024
ae7487c
feat: add error codes for res0cells and pentagons functions
mojixcoder Oct 10, 2024
549928b
feat: added error codes for vertex functions
mojixcoder Oct 10, 2024
a3ea72f
feat: added error codes for cellsToLinkedMultiPolygon function
mojixcoder Oct 10, 2024
917b205
chore: upgrade to go 1.21
mojixcoder Oct 10, 2024
a4e0c71
fix: fix lint issues
mojixcoder Oct 10, 2024
bab9b2d
fix: use any instead of interface{}
mojixcoder Oct 10, 2024
85d8786
fix: use C.uint32_t instead of uint32
mojixcoder Oct 11, 2024
c16a13b
fix: handle unknown error codes returned by h3
mojixcoder Oct 11, 2024
232113e
fix: use toErr function instead of errMap
mojixcoder Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.20"]
go-version: ["1.21"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you aren't keeping 1.20 in this list and dropping it entirely?

I don't develop in Go, so not sure what the community stance is on backwards compatibility in libraries.


steps:
- uses: actions/setup-go@v5
Expand All @@ -29,9 +29,9 @@ jobs:
strategy:
matrix:
go-version:
- "1.20"
- "1.21"
- "1.22"
- "1.23"

steps:
- uses: actions/setup-go@v5
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
linters-settings:
errcheck:
check-type-assertions: true
exhaustive:
default-signifies-exhaustive: true
goconst:
min-len: 2
min-occurrences: 3
Expand Down
12 changes: 6 additions & 6 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var (
Lat: 37,
Lng: -122,
}
cell = LatLngToCell(geo, 15)
cell, _ = LatLngToCell(geo, 15)
addr = cell.String()
geoBndry CellBoundary
cells []Cell
Expand All @@ -31,30 +31,30 @@ func BenchmarkFromString(b *testing.B) {

func BenchmarkToGeoRes15(b *testing.B) {
for n := 0; n < b.N; n++ {
geo = CellToLatLng(cell)
geo, _ = CellToLatLng(cell)
}
}

func BenchmarkFromGeoRes15(b *testing.B) {
for n := 0; n < b.N; n++ {
cell = LatLngToCell(geo, 15)
cell, _ = LatLngToCell(geo, 15)
}
}

func BenchmarkToGeoBndryRes15(b *testing.B) {
for n := 0; n < b.N; n++ {
geoBndry = CellToBoundary(cell)
geoBndry, _ = CellToBoundary(cell)
}
}

func BenchmarkHexRange(b *testing.B) {
for n := 0; n < b.N; n++ {
cells = cell.GridDisk(10)
cells, _ = cell.GridDisk(10)
}
}

func BenchmarkPolyfill(b *testing.B) {
for n := 0; n < b.N; n++ {
cells = PolygonToCells(validGeoPolygonHoles, 15)
cells, _ = PolygonToCells(validGeoPolygonHoles, 15)
}
}
7 changes: 6 additions & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import (
func ExampleLatLngToCell() {
latLng := h3.NewLatLng(37.775938728915946, -122.41795063018799)
resolution := 9
c := h3.LatLngToCell(latLng, resolution)

c, err := h3.LatLngToCell(latLng, resolution)
if err != nil {
panic(err)
}

fmt.Printf("%s", c)
// Output:
// 8928308280fffff
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/uber/h3-go/v4

go 1.20
go 1.21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why change the minimum version here? Are you using a feature that only exists in 1.21?

Copy link
Contributor Author

@mojixcoder mojixcoder Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, usually most of the libraries support 3 latest versions of Go. Makes it easier for maintainers to maintain the package.
So it depends on h3-go’s backward comptability policies.
I can downgrade to Go 1.20 as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. As I said, I don't develop in Go, so I will leave that decision to @zachcoleman and/or @jogly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only care we support the versions of Go that Go cares to support (https://go.dev/doc/devel/release), and their policy is 2 versions. Go is at 1.23 now so I support dropping 1.20 😁

Loading
Loading