{"id":15481172,"url":"https://github.com/mikeschinkel/go-typegen","last_synced_at":"2025-03-28T14:30:11.052Z","repository":{"id":205612177,"uuid":"714654023","full_name":"mikeschinkel/go-typegen","owner":"mikeschinkel","description":"Simple Golang generator package for test fixtures","archived":false,"fork":false,"pushed_at":"2024-01-14T06:16:12.000Z","size":129,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T22:45:46.561Z","etag":null,"topics":["code-generation","go","golang","test","testing","testing-tools","tests"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikeschinkel.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}},"created_at":"2023-11-05T14:09:52.000Z","updated_at":"2023-11-17T05:33:31.000Z","dependencies_parsed_at":"2024-01-14T06:52:30.676Z","dependency_job_id":null,"html_url":"https://github.com/mikeschinkel/go-typegen","commit_stats":null,"previous_names":["mikeschinkel/go-typegen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeschinkel%2Fgo-typegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeschinkel%2Fgo-typegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeschinkel%2Fgo-typegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeschinkel%2Fgo-typegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikeschinkel","download_url":"https://codeload.github.com/mikeschinkel/go-typegen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246045638,"owners_count":20714810,"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":["code-generation","go","golang","test","testing","testing-tools","tests"],"created_at":"2024-10-02T05:02:02.297Z","updated_at":"2025-03-28T14:30:11.032Z","avatar_url":"https://github.com/mikeschinkel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-typegen\nSimple generator of Golang code to instantiate a type given an instantiated object. \n\n## Intended Use-case \n\nTo create type instantiation code for use in unit testing from within code that generates over complex objects that would be hard to manually convert to use in testing.\n\n**_NOTE:_** While good testing practices create tests with small data targeted specific edge-cases, `typegen` is not intended for typical unit testing. `typegen` is for diagnosing a bug in a huge data structure where it is hard to determine what part of the data is causing error. Perfect examples for this are heavily recursive data structures, which typegen should handle with aplomb. \n\n## Usage\n\n```go\npackage main\n\nimport \"github.com/mikeschinkel/go-typegen\"\n\nfunc main() {\n  value := []int{1, 2, 3}\n  funcName := \"getData\"\n  // Replace w/package name where you will use getdata() func.\n  omitPkg := \"typegen_test\"\n  m := typegen.NewNodeMarshaler(value)\n  nodes := m.Marshal()\n  b := typegen.NewCodeBuilder(funcName, omitPkg, nodes)\n  code := b.String()\n  println(code)\n}\n```\nThe above code will print the following:\n```go\nfunc getData() []int {\n  var1 := []int{1,2,3,}\n  return var1\n}\n```\n\nSee it run [in the playground](https://goplay.tools/snippet/7SOrqjjpQTj).\n\n## Stability\nThis is brand new and likely has many rough edges. \n\nHowever, I'd like to make it robust so if you find issues either submit a PR or a bug report, please.\n\n## FAQ\n\n- Q: What not just use `fmt.Sprintf(\"%#v\", value)`?  \n- A: Because it does not recurse through complex structures.\n----\n- Q: Your question goes [here](https://github.com/mikeschinkel/go-typegen/issues/new).\n- A: ???\n\n## License\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeschinkel%2Fgo-typegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeschinkel%2Fgo-typegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeschinkel%2Fgo-typegen/lists"}