{"id":13343340,"url":"https://github.com/jimeh/go-goldsert","last_synced_at":"2026-04-13T21:31:09.801Z","repository":{"id":66924397,"uuid":"422030765","full_name":"jimeh/go-goldsert","owner":"jimeh","description":"A suite of Go test helpers which uses golden files to assert marshaling and unmarshaling of given objects.","archived":false,"fork":false,"pushed_at":"2021-10-28T02:23:47.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T13:56:45.796Z","etag":null,"topics":["assertions","go","go-test","go-test-helper","go-testing","golang","golden-file","gotest","json","marshal","marshaling","unmarshal","unmarshaling","xml","yaml"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/jimeh/go-goldsert","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/jimeh.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-10-28T01:50:09.000Z","updated_at":"2021-10-28T02:30:34.000Z","dependencies_parsed_at":"2023-02-22T21:15:56.461Z","dependency_job_id":null,"html_url":"https://github.com/jimeh/go-goldsert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jimeh/go-goldsert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgo-goldsert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgo-goldsert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgo-goldsert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgo-goldsert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimeh","download_url":"https://codeload.github.com/jimeh/go-goldsert/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgo-goldsert/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31771787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"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":["assertions","go","go-test","go-test-helper","go-testing","golang","golden-file","gotest","json","marshal","marshaling","unmarshal","unmarshaling","xml","yaml"],"created_at":"2024-07-29T19:31:08.500Z","updated_at":"2026-04-13T21:31:09.783Z","avatar_url":"https://github.com/jimeh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  go-goldsert\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e\n    A suite of Go test helpers which uses golden files to assert marshaling and unmarshaling of given objects.\n  \u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pkg.go.dev/github.com/jimeh/go-goldsert\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/%E2%80%8B-reference-387b97.svg?logo=go\u0026logoColor=white\"\n  alt=\"Go Reference\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/go-goldsert/actions\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/workflow/status/jimeh/go-goldsert/CI.svg?logo=github\" alt=\"Actions Status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codeclimate.com/github/jimeh/go-goldsert\"\u003e\n    \u003cimg src=\"https://img.shields.io/codeclimate/coverage/jimeh/go-goldsert.svg?logo=code%20climate\" alt=\"Coverage\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/go-goldsert/issues\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues-raw/jimeh/go-goldsert.svg?style=flat\u0026logo=github\u0026logoColor=white\"\nalt=\"GitHub issues\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/go-goldsert/pulls\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues-pr-raw/jimeh/go-goldsert.svg?style=flat\u0026logo=github\u0026logoColor=white\" alt=\"GitHub pull requests\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/jimeh/go-goldsert/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/jimeh/go-goldsert.svg?style=flat\" alt=\"License Status\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nEach test helper operates in two stages:\n\n1. Marshal the provided object to a byte slice and reads the corresponding\n   golden file from disk, follow by verifying both byte slices are identical.\n2. Unmarshal the content from the golden file and verify that the result is\n   identical to the original object.\n\n## Import\n\n```go\nimport \"github.com/jimeh/go-goldsert\"\n```\n\n## Usage\n\nTypical usage should look something like this in a tabular test:\n\n```go\ntype MyStruct struct {\n    FooBar string `json:\"foo_bar\" yaml:\"fooBar\" xml:\"Foo_Bar\"`\n}\n\nfunc TestMyStructMarshaling(t *testing.T) {\n    tests := []struct {\n        name string\n        obj  *MyStruct\n    }{\n        {name: \"empty\", obj: \u0026MyStruct{}},\n        {name: \"full\", obj: \u0026MyStruct{FooBar: \"Hello World!\"}},\n    }\n    for _, tt := range tests {\n        t.Run(tt.name, func(t *testing.T) {\n            goldsert.JSONMarshaling(t, tt.obj)\n            goldsert.YAMLMarshaling(t, tt.obj)\n            goldsert.XMLMarshaling(t, tt.obj)\n        })\n    }\n}\n```\n\nThe above example will read from the following golden files:\n\n- `testdata/TestMyStructMarshaling/empty/goldsert_json.golden`\n- `testdata/TestMyStructMarshaling/empty/goldsert_yaml.golden`\n- `testdata/TestMyStructMarshaling/empty/goldsert_xml.golden`\n- `testdata/TestMyStructMarshaling/full/goldsert_json.golden`\n- `testdata/TestMyStructMarshaling/full/goldsert_yaml.golden`\n- `testdata/TestMyStructMarshaling/full/goldsert_xml.golden`\n\nIf a corresponding golden file cannot be found on disk, the test will fail. To\ncreate/update golden files, simply set the `GOLDEN_UPDATE` environment variable\nto one of `1`, `y`, `t`, `yes`, `on`, or `true` when running tests.\n\nIt is highly recommended that golden files are committed to source control, as\nit allow tests to fail when the marshal results for an object changes.\n\n## Documentation\n\nPlease see the\n[Go Reference](https://pkg.go.dev/github.com/jimeh/go-goldsert#section-documentation)\nfor documentation and examples.\n\n## License\n\n[MIT](https://github.com/jimeh/go-goldsert/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimeh%2Fgo-goldsert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimeh%2Fgo-goldsert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimeh%2Fgo-goldsert/lists"}