{"id":37984104,"url":"https://github.com/ttakuya50/goor","last_synced_at":"2026-01-16T18:37:47.973Z","repository":{"id":43909139,"uuid":"266054496","full_name":"ttakuya50/goor","owner":"ttakuya50","description":"This is a CLI for creating constructors, getters and setters for structures, and is only for Golang.","archived":false,"fork":false,"pushed_at":"2020-06-16T10:38:15.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-22T12:52:21.895Z","etag":null,"topics":["constructor","generator","getter","go","golang","setter"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/ttakuya50/goor","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttakuya50.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}},"created_at":"2020-05-22T08:07:14.000Z","updated_at":"2021-01-20T13:35:20.000Z","dependencies_parsed_at":"2022-09-17T07:10:20.389Z","dependency_job_id":null,"html_url":"https://github.com/ttakuya50/goor","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ttakuya50/goor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttakuya50%2Fgoor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttakuya50%2Fgoor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttakuya50%2Fgoor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttakuya50%2Fgoor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttakuya50","download_url":"https://codeload.github.com/ttakuya50/goor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttakuya50%2Fgoor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","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":["constructor","generator","getter","go","golang","setter"],"created_at":"2026-01-16T18:37:47.181Z","updated_at":"2026-01-16T18:37:47.953Z","avatar_url":"https://github.com/ttakuya50.png","language":"Go","readme":"# goor\nThis is a CLI for creating constructors, getters and setters for structures, and is only for Golang.\n\n# Installation\n\n```shell script\n$ go get -u github.com/ttakuya50/goor\n```\nIf you want the direct binary data, please click [here](https://github.com/ttakuya50/goor/releases).\n\n# Usage\n\n```shell script\nUsage of goor:\n        goor [flags] -type=[struct type name]\nFor more information, see:\n        https://github.com/ttakuya50/goor\nFlags:\n  -getter\n        [option] when you create a constructor, you also create a getter.\n  -output string\n        [option] output file name (default \"srcdir/\u003ctype\u003e_constructor_gen.go\").\n  -pointer\n        [option] set the return value to a pointer when creating the constructor. (default true)\n  -setter\n        [option] when you create a constructor, you also create a setter.\n  -type string\n        [required] a struct type name.\n  -version\n        outputs the current version.\n```\n\nFrequently used settings are listed below.\n## 1. Create constructor.\n\n```go\n//go:generate goor -type=User\ntype User struct {\n\tid   int\n\tname string\n\tage  int\n}\n```\n\n```shell script\n$ go generate ./...\n```\n\nA file named user_constructor_gen.go will be created.\nConstructor is generated.\n```go\nfunc NewUser(\n\tid int,\n\tname string,\n\tage age,\n) *User {\n\treturn \u0026User{\n\t\tid:   id,\n\t\tname: name,\n\t\tage:  age,\n\t}\n}\n```\n\n## 2. Create constructor and getter.\n\n```go\n//go:generate goor -type=User -getter\ntype User struct {\n\tid   int\n\tname string\n\tage  int\n}\n```\n\n```shell script\n$ go generate ./...\n```\n\nA file named user_constructor_gen.go will be created.\nConstructor and getter are generated.\n```go\nfunc NewUser(\n\tid int,\n\tname string,\n\tage int,\n) *User {\n\treturn \u0026User{\n\t\tid:   id,\n\t\tname: name,\n\t\tage:  age,\n\t}\n}\n\nfunc (g *User) Id() int {\n\treturn g.id\n}\n\nfunc (g *User) Name() string {\n\treturn g.name\n}\n\nfunc (g *User) Age() int {\n\treturn g.age\n}\n```\n\n## 3. Create constructor and getter and setter.\n\n```go\n//go:generate goor -type=User -getter -setter\ntype User struct {\n\tid   int\n\tname string\n\tage  int\n}\n```\n\n```shell script\n$ go generate ./...\n```\n\nA file named user_constructor_gen.go will be created.\nConstructor and getter and setter are generated.\n```go\nfunc NewUser(\n\tid int,\n\tname string,\n\tage int,\n) *User {\n\treturn \u0026User{\n\t\tid:   id,\n\t\tname: name,\n\t\tage:  age,\n\t}\n}\n\nfunc (g *User) Id() int {\n\treturn g.id\n}\n\nfunc (g *User) Name() string {\n\treturn g.name\n}\n\nfunc (g *User) Age() int {\n\treturn g.age\n}\n\nfunc (s *User) SetId(id int) {\n\ts.id = id\n}\n\nfunc (s *User) SetName(name string) {\n\ts.name = name\n}\n\nfunc (s *User) SetAge(age int) {\n\ts.age = age\n}\n```\n\n## 4. It is also possible to exclude certain structure variables.\n\n```go\n//go:generate goor -type=User\ntype User struct {\n\tid   int `goor:\"constructor:-\"`\n\tname string\n\tage  int\n}\n```\n\n```shell script\n$ go generate ./...\n```\n\nIt is also possible to exclude certain structure variables.\n```go\nfunc NewUser(\n\tname string,\n\tage int,\n) *User {\n\treturn \u0026User{\n\t\tname: name,\n\t\tage:  age,\n\t}\n}\n```\n\n## 5. It is also possible to exclude the constructor, getter and setter of a specific structure variable.\n\n```go\n//go:generate goor -type=User -getter -setter\ntype User struct {\n\tid   int    `goor:\"getter:-\"`\n\tname string `goor:\"constructor:-;setter:-\"`\n\tage  int    `goor:\"constructor:-;getter:-;setter:-\"`\n}\n```\n\n```shell script\n$ go generate ./...\n```\n\nThe following code will be generated on its own.\n```go\nfunc NewUser(\n\tid int,\n) *User {\n\treturn \u0026User{\n\t\tid: id,\n\t}\n}\n\nfunc (g *User) Name() string {\n\treturn g.name\n}\n\nfunc (s *User) SetId(id int) {\n\ts.id = id\n}\n```\n\n## 5. Change the name of the output file.\n\n```go\n//go:generate goor -type=User -output=user_gen.go\ntype User struct {\n\tid   int\n\tname string\n\tage  int\n}\n```\n\n```shell script\n$ go generate ./...\n```\n\nThe following code will be generated in the file named user_gen.go\n```go\nfunc NewUser(\n\tid int,\n\tname string,\n\tage int,\n) *User {\n\treturn \u0026User{\n\t\tid:   id,\n\t\tname: name,\n\t\tage:  age,\n\t}\n}\n```\n\n# Examples\nCheck out the examples of how to generate code using goor in the examples directory.\n\n# Author\n[t_takuya50](https://twitter.com/t_takuya50)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttakuya50%2Fgoor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttakuya50%2Fgoor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttakuya50%2Fgoor/lists"}