{"id":37195053,"url":"https://github.com/visualfc/gox","last_synced_at":"2026-01-14T22:40:52.289Z","repository":{"id":38106140,"uuid":"382196990","full_name":"visualfc/gox","owner":"visualfc","description":"Code generator for the Go language","archived":false,"fork":true,"pushed_at":"2025-09-19T07:58:42.000Z","size":1441,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T09:45:50.855Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"goplus/gogen","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/visualfc.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}},"created_at":"2021-07-02T01:21:37.000Z","updated_at":"2025-09-19T07:58:48.000Z","dependencies_parsed_at":"2023-02-14T07:16:39.413Z","dependency_job_id":"54b4d583-95a7-46b5-ab6b-215b61154139","html_url":"https://github.com/visualfc/gox","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/visualfc/gox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualfc%2Fgox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualfc%2Fgox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualfc%2Fgox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualfc%2Fgox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visualfc","download_url":"https://codeload.github.com/visualfc/gox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualfc%2Fgox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: 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":[],"created_at":"2026-01-14T22:40:51.612Z","updated_at":"2026-01-14T22:40:52.273Z","avatar_url":"https://github.com/visualfc.png","language":"Go","readme":"gogen - Code generator for the Go language\n========\n\n[![Build Status](https://github.com/goplus/gogen/actions/workflows/go.yml/badge.svg)](https://github.com/goplus/gogen/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/goplus/gogen)](https://goreportcard.com/report/github.com/goplus/gogen)\n[![GitHub release](https://img.shields.io/github/v/tag/goplus/gogen.svg?label=release)](https://github.com/goplus/gogen/releases)\n[![Coverage Status](https://codecov.io/gh/goplus/gogen/branch/main/graph/badge.svg)](https://codecov.io/gh/goplus/gogen)\n[![GoDoc](https://pkg.go.dev/badge/github.com/goplus/gogen.svg)](https://pkg.go.dev/github.com/goplus/gogen)\n\n`gogen` is a general-purpose Go code generation toolkit with zero third-party dependencies. Like the Go compiler, It can perform type checking of expressions. For example, if you generate an expression like `\"Hello\" + 1`, it will report the corresponding error.\n\n## Quick start\n\nCreate a file named `hellogen.go`, like below:\n\n```go\npackage main\n\nimport (\n\t\"go/token\"\n\t\"go/types\"\n\t\"os\"\n\n\t\"github.com/goplus/gogen\"\n)\n\nfunc main() {\n\tpkg := gogen.NewPackage(\"\", \"main\", nil)\n\tfmt := pkg.Import(\"fmt\")\n\tv := pkg.NewParam(token.NoPos, \"v\", types.Typ[types.String]) // v string\n\n\tpkg.NewFunc(nil, \"main\", nil, nil, false).BodyStart(pkg).\n\t\tDefineVarStart(token.NoPos, \"a\", \"b\").Val(\"Hi\").Val(3).EndInit(2). // a, b := \"Hi\", 3\n\t\tNewVarStart(nil, \"c\").VarVal(\"b\").EndInit(1).                      // var c = b\n\t\tNewVar(gogen.TyEmptyInterface, \"x\", \"y\").                          // var x, y interface{}\n\t\tVal(fmt.Ref(\"Println\")).\n\t\t/**/ VarVal(\"a\").VarVal(\"b\").VarVal(\"c\"). // fmt.Println(a, b, c)\n\t\t/**/ Call(3).EndStmt().\n\t\tNewClosure(gogen.NewTuple(v), nil, false).BodyStart(pkg).\n\t\t/**/ Val(fmt.Ref(\"Println\")).Val(v).Call(1).EndStmt(). // fmt.Println(v)\n\t\t/**/ End().\n\t\tVal(\"Hello\").Call(1).EndStmt(). // func(v string) { ... } (\"Hello\")\n\t\tEnd()\n\n\tpkg.WriteTo(os.Stdout)\n}\n```\n\nTry it like:\n\n```shell\ngo mod init hello\ngo mod tidy\ngo run hellogen.go\n```\n\nThis will dump Go source code to `stdout`. The following is the output content:\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\ta, b := \"Hi\", 3\n\tvar c = b\n\tvar x, y interface{}\n\tfmt.Println(a, b, c)\n\tfunc(v string) {\n\t\tfmt.Println(v)\n\t}(\"Hello\")\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisualfc%2Fgox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisualfc%2Fgox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisualfc%2Fgox/lists"}