{"id":20687391,"url":"https://github.com/mnogu/go-dig","last_synced_at":"2026-05-06T00:02:31.009Z","repository":{"id":57541223,"uuid":"291181064","full_name":"mnogu/go-dig","owner":"mnogu","description":"Go version of Hash#dig and Array#dig in Ruby","archived":false,"fork":false,"pushed_at":"2022-05-31T23:52:41.000Z","size":12,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T22:25:42.954Z","etag":null,"topics":["array","dig","go","hash","json","ruby"],"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/mnogu.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-08-29T01:50:56.000Z","updated_at":"2024-09-09T09:19:34.000Z","dependencies_parsed_at":"2022-09-26T18:30:44.610Z","dependency_job_id":null,"html_url":"https://github.com/mnogu/go-dig","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mnogu/go-dig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-dig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-dig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-dig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-dig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnogu","download_url":"https://codeload.github.com/mnogu/go-dig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-dig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["array","dig","go","hash","json","ruby"],"created_at":"2024-11-16T22:57:09.675Z","updated_at":"2026-05-06T00:02:30.972Z","avatar_url":"https://github.com/mnogu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-dig\n\n[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/mnogu/go-dig)](https://pkg.go.dev/mod/github.com/mnogu/go-dig)\n[![GitHub Actions](https://github.com/mnogu/go-dig/workflows/Go/badge.svg)](https://github.com/mnogu/go-dig/actions?query=workflow%3AGo)\n\nGo version of [`Hash#dig`](https://docs.ruby-lang.org/en/2.7.0/Hash.html#method-i-dig) and [`Array#dig`](https://docs.ruby-lang.org/en/2.7.0/Array.html#method-i-dig) in Ruby\n\n## Download and Install\n\n```\n$ go get -u github.com/mnogu/go-dig\n```\n\n## Examples\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/mnogu/go-dig\"\n)\n\nfunc main() {\n\tvar jsonBlob = []byte(`{\"foo\": {\"bar\": {\"baz\": 1}}}`)\n\tvar v interface{}\n\tif err := json.Unmarshal(jsonBlob, \u0026v); err != nil {\n\t\tfmt.Println(err)\n\t}\n\tsuccess, err := dig.Dig(v, \"foo\", \"bar\", \"baz\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t// foo.bar.baz = 1\n\tfmt.Println(\"foo.bar.baz =\", success)\n\n\tfailure, err := dig.Dig(v, \"foo\", \"qux\", \"quux\")\n\tif err != nil {\n\t\t// key qux not found in \u003cnil\u003e\n\t\tfmt.Println(err)\n\t}\n\t// foo.qux.quux = \u003cnil\u003e\n\tfmt.Println(\"foo.qux.quux =\", failure)\n}\n```\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/mnogu/go-dig\"\n)\n\nfunc main() {\n\tvar jsonBlob = []byte(`{\"foo\": [10, 11, 12]}`)\n\tvar v interface{}\n\tif err := json.Unmarshal(jsonBlob, \u0026v); err != nil {\n\t\tfmt.Println(err)\n\t}\n\tsuccess, err := dig.Dig(v, \"foo\", 1)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t// foo.1 = 11\n\tfmt.Println(\"foo.1 =\", success)\n\n\tfailure, err := dig.Dig(v, \"foo\", 1, 0)\n\tif err != nil {\n\t\t// 11 isn't a slice\n\t\tfmt.Println(err)\n\t}\n\t// foo.1.0 = \u003cnil\u003e\n\tfmt.Println(\"foo.1.0 =\", failure)\n\n\tfailure2, err := dig.Dig(v, \"foo\", \"bar\")\n\tif err != nil {\n\t\t// [10 11 12] isn't a map\n\t\tfmt.Println(err)\n\t}\n\t// foo.bar = \u003cnil\u003e\n\tfmt.Println(\"foo.bar =\", failure2)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnogu%2Fgo-dig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnogu%2Fgo-dig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnogu%2Fgo-dig/lists"}