{"id":20217303,"url":"https://github.com/gojek/valkyrie","last_synced_at":"2025-04-10T15:42:43.930Z","repository":{"id":57480673,"uuid":"118113066","full_name":"gojek/valkyrie","owner":"gojek","description":"Go wrapper for handling zero or more errors","archived":false,"fork":false,"pushed_at":"2023-03-20T19:14:42.000Z","size":47,"stargazers_count":63,"open_issues_count":2,"forks_count":11,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-24T13:21:27.864Z","etag":null,"topics":["errors","golang","thread-safety"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gojek.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-19T10:41:53.000Z","updated_at":"2025-01-09T10:51:01.000Z","dependencies_parsed_at":"2024-06-18T15:16:05.319Z","dependency_job_id":"ec53a76c-8fdb-42d7-aa14-ca9438bd100d","html_url":"https://github.com/gojek/valkyrie","commit_stats":{"total_commits":23,"total_committers":7,"mean_commits":"3.2857142857142856","dds":0.5217391304347826,"last_synced_commit":"8f62c1e7ba45ff2cfcd96ce3b39169b3e9af1dc5"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gojek%2Fvalkyrie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gojek%2Fvalkyrie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gojek%2Fvalkyrie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gojek%2Fvalkyrie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gojek","download_url":"https://codeload.github.com/gojek/valkyrie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248243496,"owners_count":21071054,"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":["errors","golang","thread-safety"],"created_at":"2024-11-14T06:33:18.197Z","updated_at":"2025-04-10T15:42:43.898Z","avatar_url":"https://github.com/gojek.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Valkyrie\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"doc/valkyrie-logo.png\" width=\"360\" alt=\"Valkyrie Logo\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/gojektech/valkyrie\"\u003e\n\t\u003cimg src=\"https://travis-ci.org/gojektech/valkyrie.svg?branch=master\" alt=\"Build Status\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Description\nValkyrie is a utility that helps you aggregate multiple errors in Go, while maintaining thread safety.\n\n## Installation\n```\ngo get -u github.com/gojektech/valkyrie\n```\n\n## Usage\n\nConsider the case of an error prone operation, where there is a possibility of encountering multiple, mutually independant errors while running an operation. We can use Valkyrie to collate all the errors into a single error which we can then return:\n\n```go\nfunc errorProneOperation(n int) error {\n\t// Create a new Multierror instance, which implements the error interface\n\terrs := new(valkyrie.MultiError)\n\n\tfor i := 0; i \u003c n; i++ {\n\t\terrs.Push(fmt.Sprintf(\"error in iteration %d\", i))\n\t}\n\t// When you have to return an error, call the `HasError` method\n\t// which returns nil if the length of errors is 0, and returns the errs instance itself if its not\n\treturn errs.HasError()\n}\n```\n\nNow, the `errorProneOperation` can be used just like a function that returns a single error:\n\n```go\nfunc main() {\n\terr := errorProneOperation(3)\n\tif err != nil {\n\t\tfmt.Println(\"err :\", err)\n\t}\n\t// Outputs:\n\t// err : error in iteration 0, error in iteration 1, error in iteration 2\n\terr = errorProneOperation(0)\n\tif err != nil {\n\t\tfmt.Println(\"err :\", err)\n\t}\n\t// Does not output anything\n}\n```\n\nFor more documentation, you can visit [godoc.org](https://www.godoc.org/github.com/gojektech/valkyrie).\n\n## License\n\n```\nCopyright 2018, GO-JEK Tech (http://gojek.tech)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgojek%2Fvalkyrie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgojek%2Fvalkyrie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgojek%2Fvalkyrie/lists"}