{"id":51831413,"url":"https://github.com/aisk/mygo","last_synced_at":"2026-07-22T15:34:15.020Z","repository":{"id":304481729,"uuid":"1011251778","full_name":"aisk/mygo","owner":"aisk","description":"なんで……なんで「？」演算子、入れたの！？","archived":false,"fork":false,"pushed_at":"2026-07-05T16:39:16.000Z","size":315,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-05T17:14:26.354Z","etag":null,"topics":["go"],"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":"2026-07-05T16:49:04.000Z","dependencies_parsed_at":"2025-07-13T12:38:55.126Z","dependency_job_id":"de206549-98ef-4d55-bc97-4447c40758fd","html_url":"https://github.com/aisk/mygo","commit_stats":null,"previous_names":["aisk/ego","aisk/mygo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aisk/mygo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fmygo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fmygo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fmygo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fmygo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aisk","download_url":"https://codeload.github.com/aisk/mygo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fmygo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35768236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"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":["go"],"created_at":"2026-07-22T15:34:14.037Z","updated_at":"2026-07-22T15:34:14.962Z","avatar_url":"https://github.com/aisk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mygo\n\n![logo](https://github.com/user-attachments/assets/7867a592-fe16-4997-bc95-f634e453a0c7)\n\nmygo is an experimental *toy* Go preprocessor/transpiler that adds a `?` operator for concise error handling.\n\nFor example, `mygo` transforms this:\n\n```go\ns := hello()?\n```\n\ninto standard Go:\n\n```go\ns, err := hello()\nif err != nil {\n    return err\n}\n```\n\nYou can also provide a custom error handler block after `?`:\n\n```go\ns := hello()? {\n    return fmt.Errorf(\"hello failed: %w\", err)\n}\n```\n\nwhich becomes:\n\n```go\ns, err := hello()\nif err != nil {\n    return fmt.Errorf(\"hello failed: %w\", err)\n}\n```\n\n## Installation\n\n```sh\n$ go install github.com/aisk/mygo@latest\n```\n\n## Usage\n\nCreate `hello.mygo`:\n\n```go\npackage main\n\nimport (\n\t\"io\"\n\t\"os\"\n)\n\nfunc hello() error {\n\tf := os.Open(\"hello.mygo\")?\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`mygo` supports multiple ways to specify transpile targets:\n\n```sh\n$ cat hello.mygo | mygo \u003e hello.go\n$ mygo hello.mygo\n$ mygo .\n$ mygo ./...\n$ mygo ...\n```\n\n### Integrating with `go generate`\n\nYou can keep `.mygo` files as the editable source and generate `.go` files before normal Go builds:\n\n```go\n// generate.go\npackage main\n\n//go:generate mygo hello.mygo\n```\n\nThen run:\n\n```sh\n$ go generate ./...\n$ go test ./...\n```\n\nFor multiple files or packages, point the directive at a directory:\n\n```go\n//go:generate mygo .\n//go:generate mygo ./...\n```\n\n## Why\n\nmygo tries to add syntax sugar without adding runtime lock-in. The generated files are plain Go code:\n\n- no runtime dependency\n- no special library\n- no custom Go compiler\n\n## Constraints\n\nTo keep the generated Go readable, mygo intentionally avoids some rewrites:\n\n- method chaining like `a()?.b()?` is not supported\n- `?` in `for` initialization statements is not supported yet\n- expression statements like `f()?` require `f` to return only `error`; use `_ = f()?` when discarding non-error return values\n- custom handlers use the generated `err` variable and must return or otherwise handle control flow themselves\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Fmygo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faisk%2Fmygo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Fmygo/lists"}