{"id":36510101,"url":"https://github.com/bdandy/go-errors","last_synced_at":"2026-01-31T13:54:25.634Z","repository":{"id":57634957,"uuid":"424001346","full_name":"bdandy/go-errors","owner":"bdandy","description":"Simple Go library for typed const errors creation","archived":false,"fork":false,"pushed_at":"2022-04-07T12:55:21.000Z","size":56,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-15T06:12:27.407Z","etag":null,"topics":["errors","go","golang"],"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/bdandy.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}},"created_at":"2021-11-02T21:16:03.000Z","updated_at":"2023-06-26T12:34:50.000Z","dependencies_parsed_at":"2022-09-26T20:20:48.691Z","dependency_job_id":null,"html_url":"https://github.com/bdandy/go-errors","commit_stats":null,"previous_names":["bogdan-d/go-typed-errors","bdandy/go-typed-errors"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/bdandy/go-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdandy%2Fgo-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdandy%2Fgo-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdandy%2Fgo-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdandy%2Fgo-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdandy","download_url":"https://codeload.github.com/bdandy/go-errors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdandy%2Fgo-errors/sbom","scorecard":{"id":228958,"data":{"date":"2025-08-11","repo":{"name":"github.com/bdandy/go-errors","commit":"18410b7f2d4a0d5f5611865134384456faa137ad"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T04:27:27.182Z","repository_id":57634957,"created_at":"2025-08-17T04:27:27.182Z","updated_at":"2025-08-17T04:27:27.182Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28944789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T13:02:32.153Z","status":"ssl_error","status_checked_at":"2026-01-31T13:00:07.528Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["errors","go","golang"],"created_at":"2026-01-12T02:34:39.640Z","updated_at":"2026-01-31T13:54:25.625Z","avatar_url":"https://github.com/bdandy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-errors\n\n## Why this repo was created?\nMy own implementation of sentinel errors (https://dave.cheney.net/tag/errors)\n\n## Features\n- `Errors` are constants\n- `errors.Is` support\n- `Wrap` method to wrap original error with `errors.Unwrap` method\n- `String.New` support to add context arguments for error message, while `errors.Is` still compares error itself\n- `Error.WithStack` support to store stack trace at time method called\n\n\n## Way to go with errors\n\nMy recommendation is to design your packages to return all errors which are declared. \nSo you have to declare package level error, and wrap original error into your sentinel error.\n\nFor example, if your package works with filesystem, consumer don't know anything about `io.EOF` error.\n`io.EOF` should be wrapped into your custom error type `EOF` and returned to consumer, so he won't search 3rd party packages errors.\n\n### Show me the code\n\n```go \npackage mypkg\n\nimport (\n    \"io\"\n    \"errors\"\n    \n    serr \"github.com/bdandy/go-errors\"\n)\n\nconst (\n    ErrEOF = serr.String(\"EOF\")\n    ErrUnknown = serr.String(\"unknown error\")\n)\n\nfunc testfunc() error {\n    return io.EOF\n}\n\n// TestEOF returns ErrEOF or ErrUknown on some unexpected cases\n//  io.EOF is wrapped into ErrEOF so mypkg has all expected errors in one place,\n//  so it's more easy to use mypkg and handle errors \n//  (you don't have to know anything about `io` package and it's behaviour)\nfunc TestEOF() error {\n    err := testfunc() \n    \n    switch {\n    case errors.Is(io.EOF):\n        return ErrEOF.New().Wrap(err)\n    default: \n        return ErrUknown\n    }\n}\n\n```\n\n### Benchmark\nComparison with `errors.Errorf` and `pkg/errors`\n\n```\ngoos: linux\ngoarch: amd64\npkg: github.com/bdandy/go-errors\ncpu: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz\nBenchmarkWrap-8                  \t 5007164               270.9 ns/op           136 B/op          6 allocs/op\nBenchmarkWrapWithStack-8         \t 1232276               947.3 ns/op           392 B/op          7 allocs/op\nBenchmarkErrorfWrap-8                    4218820               284.9 ns/op           64 B/op           3 allocs/op\nBenchmarkPkgErrorWrap-8                  1376254               858.2 ns/op           368 B/op          6 allocs/op\nBenchmarkPkgErrorWrapWithStack-8          781378               1593 ns/op            672 B/op          9 allocs/op\nPASS\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdandy%2Fgo-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdandy%2Fgo-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdandy%2Fgo-errors/lists"}