{"id":13565025,"url":"https://github.com/xorcare/golden","last_synced_at":"2026-01-28T12:32:57.506Z","repository":{"id":52609129,"uuid":"171647370","full_name":"xorcare/golden","owner":"xorcare","description":"Package golden testing with golden files in Go. A golden file is the expected output of test, stored as a separate file rather than as a string literal inside the test code.","archived":false,"fork":false,"pushed_at":"2025-09-14T06:33:02.000Z","size":286,"stargazers_count":33,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T08:30:08.964Z","etag":null,"topics":["go","go-library","go-package","golang","golden","golden-tests","mit","testdata","testing","tests"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/xorcare/golden","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/xorcare.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":"2019-02-20T09:58:17.000Z","updated_at":"2025-09-14T06:33:05.000Z","dependencies_parsed_at":"2024-02-08T23:24:15.332Z","dependency_job_id":"9d454734-115e-45bb-b727-ba16a21951de","html_url":"https://github.com/xorcare/golden","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/xorcare/golden","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fgolden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fgolden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fgolden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fgolden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xorcare","download_url":"https://codeload.github.com/xorcare/golden/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fgolden/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"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":["go","go-library","go-package","golang","golden","golden-tests","mit","testdata","testing","tests"],"created_at":"2024-08-01T13:01:39.392Z","updated_at":"2026-01-28T12:32:57.466Z","avatar_url":"https://github.com/xorcare.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Golden\n\n[![codecov](https://codecov.io/gh/xorcare/golden/badge.svg)](https://codecov.io/gh/xorcare/golden)\n[![Go Report Card](https://goreportcard.com/badge/github.com/xorcare/golden)](https://goreportcard.com/report/github.com/xorcare/golden)\n[![GoDoc](https://godoc.org/github.com/xorcare/golden?status.svg)](https://godoc.org/github.com/xorcare/golden)\n\nPackage golden testing with golden files in Go. A golden file is the expected\noutput of test, stored as a separate file rather than as a string literal inside\nthe test code. So when the test is executed, it will read data from the file and\ncompare it to the output produced by the functionality under test.\n\nWhen writing unit tests, there comes a point when you need to check that the\ncomplex output of a function matches your expectations. This could be binary\ndata (like an Image, JSON, HTML etc). Golden files are a way of ensuring your\nfunction output matches its .golden file. It’s a pattern used in the Go standard\nlibrary.\n\nOne of the advantages of the gold files approach is that you can easily update\nthe test data using the command line flag without copying the data into the text\nvariables of go this is very convenient in case of  significant changes in the\nbehavior of the system but also requires attention to the changed test data and\nchecking the correctness of the new golden results.\n\nA special cli is provided in the package. The special flag `-update` is\nprovided in the package for conveniently updating ethos files, for example,\nusing the following command:\n\n\tgo test ./... -update\n\nGolden files are placed in directory `testdata` this directory is ignored by\nthe standard tools go, and it can accommodate a variety of data used in test or\nsamples.\n\n## Installation\n\n```bash\ngo get github.com/xorcare/golden\n```\n\n## Examples\n\n * [golden.Assert](https://godoc.org/github.com/xorcare/golden#example-Assert)\n * [golden.Read](https://godoc.org/github.com/xorcare/golden#example-Read)\n * [golden.Run](https://godoc.org/github.com/xorcare/golden#example-Run)\n\n## Inspiration\n\n * [Golden Files—Why you should use them](https://medium.com/@jarifibrahim/golden-files-why-you-should-use-them-47087ec994bf)\n * [Testing with golden files in Go](https://medium.com/soon-london/testing-with-golden-files-in-go-7fccc71c43d3)\n * [Go advanced testing tips \u0026 tricks](https://medium.com/@povilasve/go-advanced-tips-tricks-a872503ac859)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxorcare%2Fgolden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxorcare%2Fgolden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxorcare%2Fgolden/lists"}