{"id":20388192,"url":"https://github.com/abrander/gowasm-geolocation","last_synced_at":"2026-04-19T02:32:37.925Z","repository":{"id":57558633,"uuid":"322798936","full_name":"abrander/gowasm-geolocation","owner":"abrander","description":"Go  package for the browser's geolocation API","archived":false,"fork":false,"pushed_at":"2020-12-20T17:02:33.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-04T23:42:01.205Z","etag":null,"topics":["geolocation-api","go","golang","wasm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abrander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-19T08:13:17.000Z","updated_at":"2024-04-18T14:59:46.000Z","dependencies_parsed_at":"2022-09-15T19:01:44.964Z","dependency_job_id":null,"html_url":"https://github.com/abrander/gowasm-geolocation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abrander/gowasm-geolocation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrander%2Fgowasm-geolocation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrander%2Fgowasm-geolocation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrander%2Fgowasm-geolocation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrander%2Fgowasm-geolocation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abrander","download_url":"https://codeload.github.com/abrander/gowasm-geolocation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrander%2Fgowasm-geolocation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geolocation-api","go","golang","wasm"],"created_at":"2024-11-15T03:07:50.105Z","updated_at":"2026-04-19T02:32:37.889Z","avatar_url":"https://github.com/abrander.png","language":"Go","readme":"# gowasm-geolocation\n\nGeolocation is an idiomatic and intuitive Go package for using\nthe browser's geolocation API.\n\n[![GoDoc][1]][2]\n\n[1]: https://godoc.org/github.com/abrander/gowasm-geolocation?status.svg\n[2]: https://godoc.org/github.com/abrander/gowasm-geolocation\n\n## Examples\n\n### Getting the device position\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/abrander/gowe/geolocation\"\n)\n\nfunc main() {\n\toptions := \u0026geolocation.PositionOptions{\n\t\tHighAccuracy: true,\n\t}\n\n\tpos, err := geolocation.CurrentPosition(options)\n\tif err != nil {\n\t\tfmt.Printf(\"Ohh no: %s\\n\", err.Error())\n\t}\n\n\tfmt.Printf(\"Got position at %s: %+v\\n\", pos.Timestamp.String(), pos.Coords)\n}\n```\n\n\n### Watching the device position\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/abrander/gowe/geolocation\"\n)\n\nfunc main() {\n\tw := geolocation.WatchPosition(nil)\n\n\tfor {\n\t\tpos, err := w.Next()\n\t\tif err != nil {\n\t\t\tif err.Temporary() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfmt.Printf(\"Something went wrong: %s\\n\", err.Error())\n\n\t\t\tbreak\n\t\t}\n\n\t\tfmt.Printf(\"Got new position at %s: %+v\\n\", pos.Timestamp.String(), pos.Coords)\n\t}\n\tw.Close()\n}\n```\n\n### Integrate in a select style main loop\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/abrander/gowe/geolocation\"\n)\n\nfunc main() {\n\toptions := \u0026geolocation.PositionOptions{\n\t\tMaximumAge: 10 * time.Second,\n\t}\n\n\tw := geolocation.WatchPosition(options)\n\tpositions, locationErrors := w.Chans()\n\nMAIN:\n\tfor {\n\t\tselect {\n\t\tcase pos := \u003c-positions:\n\t\t\tfmt.Printf(\"Got position at %s: %+v\\n\", pos.Timestamp.String(), pos.Coords)\n\t\tcase err := \u003c-locationErrors:\n\t\t\tfmt.Printf(\"Ohh no: %s\\n\", err.Error())\n\t\t\tif !err.Temporary() {\n\t\t\t\tbreak MAIN\n\t\t\t}\n\t\t}\n\t}\n\n\tw.Close()\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabrander%2Fgowasm-geolocation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabrander%2Fgowasm-geolocation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabrander%2Fgowasm-geolocation/lists"}