{"id":16950825,"url":"https://github.com/jackc/ego","last_synced_at":"2025-03-21T10:42:05.176Z","repository":{"id":136156077,"uuid":"110374322","full_name":"jackc/ego","owner":"jackc","description":"Experimental shorthand for Go error handling.","archived":false,"fork":false,"pushed_at":"2017-11-11T19:39:09.000Z","size":1,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-26T07:11:47.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jackc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-11T19:38:27.000Z","updated_at":"2018-02-03T07:55:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cef79a1-d364-4b73-a8bb-7a51b61faf6b","html_url":"https://github.com/jackc/ego","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fego","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fego/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fego/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fego/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackc","download_url":"https://codeload.github.com/jackc/ego/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244780630,"owners_count":20509425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-13T21:58:37.926Z","updated_at":"2025-03-21T10:42:05.144Z","avatar_url":"https://github.com/jackc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ego\n\nEgo is an experimental shorthand for Go error handling.\n\n```\njack@happy:~/dev/go/src/github.com/jackc/ego$ cat example_in.go\npackage foo\n\nimport \"io\"\n\nfunc bar3(w io.Writer) error {\n  _, err := w.Write([]byte(\"foo\")) //; if err != nil { return err }\n  _, err = w.Write([]byte(\"bar\"))  //; if err != nil { return err }\n  _, err = w.Write([]byte(\"baz\"))  //; if err != nil { return err }\n  _, err = w.Write([]byte(\"quz\"))  //; if err != nil { return err }\n  return nil\n}\njack@happy:~/dev/go/src/github.com/jackc/ego$ ruby ego_expand.rb \u003c example_in.go | gofmt\npackage foo\n\nimport \"io\"\n\nfunc bar3(w io.Writer) error {\n  _, err := w.Write([]byte(\"foo\"))\n  if err != nil {\n    return err\n  }\n  _, err = w.Write([]byte(\"bar\"))\n  if err != nil {\n    return err\n  }\n  _, err = w.Write([]byte(\"baz\"))\n  if err != nil {\n    return err\n  }\n  _, err = w.Write([]byte(\"quz\"))\n  if err != nil {\n    return err\n  }\n  return nil\n}\n```\n\n```\njack@happy:~/dev/go/src/github.com/jackc/ego$ cat example_out.go\npackage foo\n\nimport \"io\"\n\nfunc bar3(w io.Writer) error {\n  _, err := w.Write([]byte(\"foo\"))\n  if err != nil {\n    return err\n  }\n  _, err = w.Write([]byte(\"bar\"))\n  if err != nil {\n    return err\n  }\n  _, err = w.Write([]byte(\"baz\"))\n  if err != nil {\n    return err\n  }\n  _, err = w.Write([]byte(\"quz\"))\n  if err != nil {\n    return err\n  }\n  return nil\n}\njack@happy:~/dev/go/src/github.com/jackc/ego$ ruby ego_contract.rb \u003c example_out.go\npackage foo\n\nimport \"io\"\n\nfunc bar3(w io.Writer) error {\n  _, err := w.Write([]byte(\"foo\")) //; if err != nil { return err }\n  _, err = w.Write([]byte(\"bar\")) //; if err != nil { return err }\n  _, err = w.Write([]byte(\"baz\")) //; if err != nil { return err }\n  _, err = w.Write([]byte(\"quz\")) //; if err != nil { return err }\n  return nil\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackc%2Fego","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackc%2Fego","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackc%2Fego/lists"}