{"id":30091882,"url":"https://github.com/aisk/ego","last_synced_at":"2025-10-12T10:39:33.876Z","repository":{"id":304481729,"uuid":"1011251778","full_name":"aisk/ego","owner":"aisk","description":"It's not MyGO!!!!!","archived":false,"fork":false,"pushed_at":"2025-08-10T08:13:52.000Z","size":307,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-14T05:36:19.837Z","etag":null,"topics":[],"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/aisk.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-30T14:28:06.000Z","updated_at":"2025-09-12T02:55:25.000Z","dependencies_parsed_at":"2025-07-13T12:38:55.126Z","dependency_job_id":"de206549-98ef-4d55-bc97-4447c40758fd","html_url":"https://github.com/aisk/ego","commit_stats":null,"previous_names":["aisk/ego"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aisk/ego","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fego","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fego/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fego/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fego/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aisk","download_url":"https://codeload.github.com/aisk/ego/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fego/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011058,"owners_count":26084865,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":[],"created_at":"2025-08-09T07:53:21.663Z","updated_at":"2025-10-12T10:39:33.840Z","avatar_url":"https://github.com/aisk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ego \n\n![logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tszc13irysyrnvg34lzp.png)\n\n`ego` means **E**rror can be handled implicitly in **GO**.\n\nIt's an experimental *toy* Go preprocessor/transpiler that introduces the `?` operator for more concise error handling. It aims to reduce boilerplate code by replacing verbose error checks with a single character.\n\nFor example, `ego` transforms this:\n\n```go\ns := hello()?\n```\n\nInto this:\n\n```go\ns, err := hello()\nif err != nil {\n    return err\n}\n```\n\n## Installation\n\n```sh\n$ go install github.com/aisk/ego@latest\n```\n\n## Usage\n\nCreate a file named `hello.ego` with the following content:\n\n```go\npackage main\n\nimport (\n\t\"io\"\n\t\"os\"\n)\n\nfunc hello() error {\n\tf := os.Open(\"hello.ego\")?\n\tdefer f.Close()\n\ts := io.ReadAll(f)?\n\tprintln(string(s))\n\treturn nil\n}\n\nfunc main() {\n\thello()\n}\n```\n\n`ego` supports multiple ways to specify transpile targets:\n\n```sh\n# Transpile from stdin\n$ cat hello.ego | ego \u003e hello.go\n\n# Transpile specific files\n$ ego hello.ego\n\n# Transpile all .ego files in a directory (non-recursive)\n$ ego .\n\n# Transpile all .ego files recursively\n$ ego ./...\n\n# Transpile all .ego files in current directory recursively\n$ ego ...\n```\n\nThe transpiled `hello.go` will contain:\n\n```go\npackage main\n\nimport (\n\t\"io\"\n\t\"os\"\n)\n\nfunc hello() error {\n\tf, err := os.Open(\"hello.ego\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\ts, err := io.ReadAll(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprintln(string(s))\n\treturn nil\n}\n\nfunc main() {\n\thello()\n}\n\n```\n\n## Design Principles\n\nThe goal of this project is to design a Go language extension with more syntactic sugar, implemented as a preprocessor. The precompiled result is **completely standard Go code**, indistinguishable from hand-written Go code.\n\n**Core Design Philosophy: Zero Lock-in**\n\n- If you decide this project isn't suitable, you can simply delete all `.ego` files and continue development with the original Go code\n- If your team doesn't want to introduce ego, you can edit `.ego` files locally and commit the generated standard Go code to your version control server\n- The precompiled Go code has no runtime dependencies or special libraries\n\n**Design Constraints**\n\nTo achieve zero lock-in, there are some intentional limitations:\n\n1. **The ? operator does not support method chaining** - For example, `a()?.b()?` is not supported because it would require introducing intermediate variables, and it's difficult to provide reasonable names for these variables\n2. **Currently does not support the ? operator in for loop initialization statements** - For example, `for item := range getItems()?` is not yet supported. This limitation may be removed in the future\n3. **When discarding return values, functions must have only an error return** - When you don't accept any return values from a function (i.e., when using `f()?`), the function must have exactly one return value of type `error`. If a function returns multiple values (e.g., `func f() (int, error)`), you need to use `_` to discard the non-error return values: `_ = f()?`\n\nThese constraints ensure the generated Go code remains clean, readable, and identical to hand-written code.\n\n## TODO\n\n- [ ] Implement a Go-compatible command-line tool that supports all Go flags and commands, with the only difference being that it preprocesses all `.ego` files to `.go` files before running compile or test operations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Fego","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faisk%2Fego","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Fego/lists"}