{"id":20157584,"url":"https://github.com/g4s8/envdoc","last_synced_at":"2025-08-02T21:05:53.632Z","repository":{"id":211867613,"uuid":"730104012","full_name":"g4s8/envdoc","owner":"g4s8","description":"Go tool to generate documentation for environment variables","archived":false,"fork":false,"pushed_at":"2025-07-08T18:31:32.000Z","size":283,"stargazers_count":86,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-08T19:40:03.500Z","etag":null,"topics":["devtools","documentation","go","go-generate"],"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/g4s8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2023-12-11T08:05:25.000Z","updated_at":"2025-07-08T18:30:39.000Z","dependencies_parsed_at":"2024-01-08T16:09:13.945Z","dependency_job_id":"9e570b65-d518-48c7-9357-8850eb86ab35","html_url":"https://github.com/g4s8/envdoc","commit_stats":null,"previous_names":["g4s8/envdoc"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/g4s8/envdoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fenvdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fenvdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fenvdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fenvdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g4s8","download_url":"https://codeload.github.com/g4s8/envdoc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fenvdoc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268454345,"owners_count":24253147,"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-08-02T02:00:12.353Z","response_time":74,"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":["devtools","documentation","go","go-generate"],"created_at":"2024-11-13T23:46:58.242Z","updated_at":"2025-08-02T21:05:53.560Z","avatar_url":"https://github.com/g4s8.png","language":"Go","readme":"# envdoc\n\nenvdoc is a tool for generating documentation for environment variables in Go structs.\nIt takes comments associated with `env` tags in Go structs and creates a Markdown, plaintext or HTML\nfile with detailed documentation.\n\nFor `docenv` linter see [docenv/README.md](./docenv/README.md).\n\n\u003cbr/\u003e\n\n[![CI](https://github.com/g4s8/envdoc/actions/workflows/go.yml/badge.svg)](https://github.com/g4s8/envdoc/actions/workflows/go.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/g4s8/envdoc.svg)](https://pkg.go.dev/github.com/g4s8/envdoc)\n[![codecov](https://codecov.io/gh/g4s8/envdoc/graph/badge.svg?token=sqXWNR755O)](https://codecov.io/gh/g4s8/envdoc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/g4s8/envdoc)](https://goreportcard.com/report/github.com/g4s8/envdoc)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)  \n\n## Installation\n\n### Go \u003e= 1.24\n\nAdd `envdoc` tool and install it:\n```bash\ngo get -tool github.com/g4s8/envdoc@latest\ngo install tool\n```\n\nAdd `go:generate`:\n```go\n//go:generate envdoc -output config.md\ntype Config struct {\n    // ...\n}\n```\n\nGenerate:\n```bash\ngo generate ./...\n```\n\n### Before Go 1.24\n\nRun it with `go run` in source file:\n```go\n//go:generate go run github.com/g4s8/envdoc@latest -output environments.md\ntype Config struct {\n    // ...\n}\n```\n\nOr download binary to run it:\n```bash\ngo install github.com/g4s8/envdoc@latest\n```\n\nAnd use it in code:\n\n```go\n//go:generate envdoc -output environments.md\ntype Config struct {\n    // ...\n}\n```\n\n## Usage\n\n```go\n//go:generate envdoc -output \u003coutput_file_name\u003e\n```\n\n * `-dir` (path string, *optional*) - Specify the directory to search for files. Default is the file dir with `go:generate` command.\n * `-files` (glob string, *optional*) - File glob pattern to specify file names to process. Default is the single file with `go:generate`.\n * `-types` (glob string, *optional*) - Type glob pattern for type names to process. If not specified, the next type after `go:generate` is used.\n * `-target` (`enum(caarlos0, cleanenv)` string, optional, default `caarlos0`) - Set env library target.\n * `-output` (path string, **required**) - Output file name for generated documentation.\n * `-format` (`enum(markdown, plaintext, html, dotenv, json)` string, *optional*) - Output format for documentation.  Default is `markdown`.\n * `-no-styles` (`bool`, *optional*) - If true, CSS styles will not be included for `html` format.\n * `-env-prefix` (`string`, *optional*) - Sets additional global prefix for all environment variables.\n * `-tag-name` (string, *optional*, default: `env`) - Use custom tag name instead of `env`.\n * `-tag-default` (string, *optional*, default: `envDefault`) - Use \"default\" tag name instead of `envDefault`.\n * `-required-if-no-def` (bool, *optional*, default: `false`) - Set attributes as required if no default value is set.\n * `-field-names` (`bool`, *optional*) - Use field names as env names if `env:` tag is not specified.\n * `-debug` (`bool`, *optional*) - Enable debug output.\n\nThese params are deprecated and will be removed in the next major release:\n * `-type` - Specify one type to process.\n * `-all` - Process all types in a file.\n\nBoth parameters could be replaced with `-types` param:\n - Use `-types=Foo` instead of `-type=Foo`.\n - Use `-types='*'` instead of `-all`.\n\n## Example\n\nSuppose you have the following Go file `config.go`:\n\n```go\npackage foo\n\n//go:generate envdoc --output env-doc.md\ntype Config struct {\n  // Port to listen for incoming connections\n  Port int `env:\"PORT,required\"`\n  // Address to serve\n  Address string `env:\"ADDRESS\" envDefault:\"localhost\"`\n}\n```\n\nAnd the `go:generate` line above creates documentation in `env-doc.md` file:\n\n```md\n# Environment Variables\n\n- `PORT` (**required**) - Port to listen for incoming connections\n- `ADDRESS` (default: `localhost`) - Address to serve\n```\n\nSee [_examples](./_examples/) dir for more details.\n\n## Compatibility\n\nThis tool is compatible with\n- full compatibility: [caarlos0/env](https://github.com/caarlos0/env)\n- full compatibility: [ilyakaznacheev/cleanenv](https://github.com/ilyakaznacheev/cleanenv)\n- partial compatibility: [sethvargo/go-envconfig](https://github.com/sethvargo/go-envconfig)\n- partial compatibility: [joeshaw/envdecode](https://github.com/joeshaw/envdecode)\n\n*Let me know about any new lib to check compatibility.*\n\n\n## Contributing\n\nIf you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](/LICENSE.md) file for details.\n","funding_links":[],"categories":["Go Generate Tools","Go 生成工具"],"sub_categories":["Routers","Search and Analytic Databases","路由器"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4s8%2Fenvdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg4s8%2Fenvdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4s8%2Fenvdoc/lists"}