{"id":22964890,"url":"https://github.com/susji/typestringer","last_synced_at":"2025-07-31T06:12:51.842Z","repository":{"id":235605934,"uuid":"790972888","full_name":"susji/typestringer","owner":"susji","description":"typestringer is a program for generating Go code based on type names","archived":false,"fork":false,"pushed_at":"2024-04-23T21:50:32.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T15:11:47.334Z","etag":null,"topics":["code-generation","go","gogenerate","gogenerator","golang","stringer","type","typename","types"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/susji.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}},"created_at":"2024-04-23T21:31:29.000Z","updated_at":"2024-04-23T21:52:10.000Z","dependencies_parsed_at":"2024-04-23T23:53:52.222Z","dependency_job_id":"08e0812e-41d6-4a31-b772-e12d6ed7794a","html_url":"https://github.com/susji/typestringer","commit_stats":null,"previous_names":["susji/typestringer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/susji/typestringer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susji%2Ftypestringer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susji%2Ftypestringer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susji%2Ftypestringer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susji%2Ftypestringer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/susji","download_url":"https://codeload.github.com/susji/typestringer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susji%2Ftypestringer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267997183,"owners_count":24178251,"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-07-31T02:00:08.723Z","response_time":66,"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":["code-generation","go","gogenerate","gogenerator","golang","stringer","type","typename","types"],"created_at":"2024-12-14T20:12:48.589Z","updated_at":"2025-07-31T06:12:51.817Z","avatar_url":"https://github.com/susji.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# typestringer\n\nThis program can be used to generate customizable code based on Go type names.\nOne example would be the generation of `String()` functions to fulfill [the\nStringer interface](https://pkg.go.dev/fmt#Stringer).\n\n# Usage\n\n    $ typestringer -help\n\nSeveral options exist for customizing the generated code. `-include` and\n`-ignore` may be used to define regular expressions for matching or not matching\nspecific types. Diagnostic output is written to standard error and generated\ncode by default to files located in the package paths. `-stdout` may be used to\nredirect the generated code to standard output.\n\nAs usual, typestringer may also be executed with `go generate` by including a\ncomment such as the following somewhere in your code:\n\n```go\n//go:generate typestringer\n```\n\n# Installing\n\nBuilds for many platforms can be found\n[here](https://github.com/susji/typestringer/releases). You may also use the Go\ntoolchain:\n\n    $ go install github.com/susji/typestringer@latest\n\n# Examples\n\nThe examples below use the typestringer code.\n\n## Basic\n\nThe type-specific format string is expanded with the type name passed two times\nso escaping other formatting directives must be done with `%%`:\n\n```shell\n$ typestringer \\\n      -stdout \\\n      -preamble 'import fmt' \\\n      -fmt 'func (t %s) String() string { return fmt.Sprintf(\"%s=%%v\", t) }'\n```\n\nThe generated code looks like this:\n\n```go\n// Automatically generated by typestringer with the following parameters:\n//   -stdout\n//   -preamble\n//   import fmt\n//   -fmt\n//   func (t %s) String() string { return fmt.Sprintf(\"%s=%%v\", t) }\npackage main\n\nimport fmt\n\nfunc (t stringsvar) String() string { return fmt.Sprintf(\"stringsvar=%v\", t) }%\n```\n\n## Chaining\n\nIf specific types should be treated differently and one generated file is\ndesired, something like the following may be done:\n\n```shell\n$ { typestringer \\\n      -stdout \\\n      -preamble 'import fmt' \\\n      -include '^FIRST$' \\\n      -fmt 'func (t %s) String() string { return fmt.Sprintf(\"%s=%%v\", t) }'$'\\n' \\\n      ./generator/testdata/two;\n    typestringer \\\n      -stdout \\\n      -no-package \\\n      -include '^SECOND$' \\\n      -fmt 'func (t %s) String() string { return \"%s\" }'$'\\n' \\\n      ./generator/testdata/two;\n  } 2\u003e/dev/null\n```\n\nThe generated code looks like this:\n\n```go\n// Automatically generated by typestringer with the following parameters:\n//   -stdout\n//   -preamble\n//   import fmt\n//   -include\n//   ^FIRST$\n//   -fmt\n//   func (t %s) String() string { return fmt.Sprintf(\"%s=%%v\", t) }\n\n//   ./generator/testdata/two\npackage two\n\nimport fmt\n\nfunc (t FIRST) String() string { return fmt.Sprintf(\"FIRST=%v\", t) }\n// Automatically generated by typestringer with the following parameters:\n//   -stdout\n//   -no-package\n//   -include\n//   ^SECOND$\n//   -fmt\n//   func (t %s) String() string { return \"%s\" }\n\n//   ./generator/testdata/two\nfunc (t SECOND) String() string { return \"SECOND\" }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusji%2Ftypestringer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsusji%2Ftypestringer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusji%2Ftypestringer/lists"}