{"id":13371302,"url":"https://github.com/drewstinnett/gout","last_synced_at":"2025-07-02T10:06:51.088Z","repository":{"id":57576057,"uuid":"356044190","full_name":"drewstinnett/gout","owner":"drewstinnett","description":"Output go objects in standard formats, such as YAML, JSON, etc","archived":false,"fork":false,"pushed_at":"2024-02-24T22:07:41.000Z","size":159,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-20T03:22:37.484Z","etag":null,"topics":["go","golang","json","output","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drewstinnett.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,"publiccode":null,"codemeta":null}},"created_at":"2021-04-08T20:48:17.000Z","updated_at":"2024-06-19T01:48:22.214Z","dependencies_parsed_at":"2024-02-15T00:24:28.266Z","dependency_job_id":"865ec795-688d-41ca-b0eb-28938d9c77c6","html_url":"https://github.com/drewstinnett/gout","commit_stats":null,"previous_names":["drewstinnett/go-output-format"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/drewstinnett/gout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewstinnett%2Fgout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewstinnett%2Fgout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewstinnett%2Fgout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewstinnett%2Fgout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drewstinnett","download_url":"https://codeload.github.com/drewstinnett/gout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewstinnett%2Fgout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263118063,"owners_count":23416357,"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":["go","golang","json","output","yaml"],"created_at":"2024-07-30T02:01:28.177Z","updated_at":"2025-07-02T10:06:51.064Z","avatar_url":"https://github.com/drewstinnett.png","language":"Go","funding_links":[],"categories":["Bot Building","文本处理","Text Processing"],"sub_categories":["Markup Languages","标记语言"],"readme":"# GOUT (Previously go-output-format)\n\n[![Test](https://github.com/drewstinnett/gout/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/drewstinnett/gout/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/drewstinnett/gout/branch/main/graph/badge.svg?token=KBITDOWZLQ)](https://codecov.io/gh/drewstinnett/gout)\n[![Go Report Card](https://goreportcard.com/badge/github.com/drewstinnett/gout)](https://goreportcard.com/report/github.com/drewstinnett/gout)\n[![Go Reference](https://pkg.go.dev/badge/github.com/drewstinnett/gout.svg)](https://pkg.go.dev/github.com/drewstinnett/gout/v2)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\n`gout` is the Go OUTput Formatter for serializing data in a standard way.\n\nHelper utility to output data structures in to standardized formats, much like\nwhat is built in to [vault](https://www.vaultproject.io/),\n[az](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) and\n[kubectl](https://kubernetes.io/docs/tasks/tools/)\n\nI really like how these apps provide for flexible output, but wanted a way to\ndo it without needing to re-write or copy it for every new tool.\n\nNeed to parse some output with `jq`?  JSON is your format. Want to put\nit out in an easy to read yet still standardized format?  YAML is for you!\n\nThis tool is intended to provide all that in a single reusable package.\n\n## Usage\n\n```go\nimport \"github.com/drewstinnett/gout/v2\"\n```\n\n### Builtin\n\nGout now comes with a builtin instance, similar to the way Viper does things.\n\nExample Usage:\n\n```go\ngout.MustPrint(struct {\n  FirstName string\n  LastName  string\n}{\n  FirstName: \"Bob\",\n  LastName:  \"Ross\",\n})\n```\n\nFull example code [here](./_examples/builtin/main.go)\n\n### Custom\n\nExample Usage:\n\n```go\n// Create a new instance\nw, err := gout.New()\nif err != nil {\n  panic(err)\n}\n\n// Use a custom writer\nw.SetWriter(os.Stderr)\n\n// Print something!\nw.MustPrint(struct {\n  FirstName string\n  LastName  string\n}{\n  FirstName: \"Bob\",\n  LastName:  \"Ross\",\n})\n// {\"FirstName\":\"Bob\",\"LastName\":\"Ross\"}\n```\n\n## Built-in Formatters\n\n### YAML\n\nUses the standard `gopkg.in/yaml.v3` library.\n\n### JSON\n\nUses the standard `encoding/json` library.\n\n### TOML\n\nUses `github.com/pelletier/go-toml/v2` library\n\n### CSV\n\nUses `github.com/jszwec/csvutil` library. NOTE: You must pass an iterable\ninterface in when using this format. It won't do a single struct.\n\n### XML\n\nUses `encoding/xml` library. NOTE: This plugin only works with structs supported\nby the base library\n\n### Plain\n\nThis is just vanilla old Golang output, using the `%+v` format.\n\n### GoTemplate\n\nUse this format to parse the data in to a golang template. Useful for spitting\ndata out in a more arbitrary format. This uses the `text/template` package to\nparse each item in the return slice. See [the example\nhere](_examples/gotemplate/main.go) for full details.\n\n## Related Projects\n\n* [Gout-Cobra](https://github.com/drewstinnett/gout-cobra) - Configure a cobra.Command to output using Gout\n\n## Coming Soon?\n\n### TSV (Tab Separated Values)\n\nIntention here is to have a simple way to print out a data structure in a way\nthat grep and the like can parse it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewstinnett%2Fgout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrewstinnett%2Fgout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewstinnett%2Fgout/lists"}