{"id":46761012,"url":"https://github.com/csueiras/reinforcer","last_synced_at":"2026-03-09T22:17:23.008Z","repository":{"id":37862710,"uuid":"336599480","full_name":"csueiras/reinforcer","owner":"csueiras","description":"codegen for easy adoption of resiliency patterns","archived":false,"fork":false,"pushed_at":"2023-03-06T11:02:46.000Z","size":296,"stargazers_count":9,"open_issues_count":13,"forks_count":2,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2026-01-27T13:15:52.696Z","etag":null,"topics":["codegen","distributed-systems","golang","high-scalability","resiliency"],"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/csueiras.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-02-06T17:48:04.000Z","updated_at":"2025-12-14T18:46:07.000Z","dependencies_parsed_at":"2024-06-19T09:58:52.647Z","dependency_job_id":null,"html_url":"https://github.com/csueiras/reinforcer","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/csueiras/reinforcer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csueiras%2Freinforcer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csueiras%2Freinforcer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csueiras%2Freinforcer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csueiras%2Freinforcer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csueiras","download_url":"https://codeload.github.com/csueiras/reinforcer/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csueiras%2Freinforcer/sbom","scorecard":{"id":311466,"data":{"date":"2025-08-11","repo":{"name":"github.com/csueiras/reinforcer","commit":"cedd4b719c951bb9ff7047c9e4e825ae8bc33a5e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/13 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/ci.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/csueiras/reinforcer/release.yml/develop?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1","Info:   0 out of   9 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned"],"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":"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":"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":"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":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.10.0 not signed: https://api.github.com/repos/csueiras/reinforcer/releases/41027714","Warn: release artifact v0.9.1 not signed: https://api.github.com/repos/csueiras/reinforcer/releases/40664338","Warn: release artifact v0.9.0 not signed: https://api.github.com/repos/csueiras/reinforcer/releases/40120830","Warn: release artifact v0.8.0 not signed: https://api.github.com/repos/csueiras/reinforcer/releases/39408822","Warn: release artifact v0.7.2 not signed: https://api.github.com/repos/csueiras/reinforcer/releases/38949561","Warn: release artifact v0.10.0 does not have provenance: https://api.github.com/repos/csueiras/reinforcer/releases/41027714","Warn: release artifact v0.9.1 does not have provenance: https://api.github.com/repos/csueiras/reinforcer/releases/40664338","Warn: release artifact v0.9.0 does not have provenance: https://api.github.com/repos/csueiras/reinforcer/releases/40120830","Warn: release artifact v0.8.0 does not have provenance: https://api.github.com/repos/csueiras/reinforcer/releases/39408822","Warn: release artifact v0.7.2 does not have provenance: https://api.github.com/repos/csueiras/reinforcer/releases/38949561"],"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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-17T23:14:36.827Z","repository_id":37862710,"created_at":"2025-08-17T23:14:36.827Z","updated_at":"2025-08-17T23:14:36.827Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30314617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"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":["codegen","distributed-systems","golang","high-scalability","resiliency"],"created_at":"2026-03-09T22:17:22.494Z","updated_at":"2026-03-09T22:17:22.996Z","avatar_url":"https://github.com/csueiras.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reinforcer\n\n![Tests](https://github.com/csueiras/reinforcer/workflows/run%20tests/badge.svg?branch=develop)\n[![Coverage Status](https://coveralls.io/repos/github/csueiras/reinforcer/badge.svg?branch=develop)](https://coveralls.io/github/csueiras/reinforcer?branch=develop)\n[![Go Report Card](https://goreportcard.com/badge/github.com/csueiras/reinforcer)](https://goreportcard.com/report/github.com/csueiras/reinforcer)\n[![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/csueiras/reinforcer?include_prereleases\u0026sort=semver)](https://github.com/csueiras/reinforcer/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nReinforcer is a code generation tool that automates middleware injection in a proxy service that fronts your delegate\nimplementation, this aids in building more resilient code as you can use common resiliency patterns in the middlewares\nsuch as circuit breakers, retrying, timeouts and others.\n\n**NOTE:** _While version is \u003c 1.0.0 the APIs might dramatically change between minor versions, any breaking changes will\nbe enumerated here starting with version 0.7.0 and forward._\n\n## Install\n\n### Releases\n\nVisit the [releases page](https://github.com/csueiras/reinforcer/releases) for pre-built binaries for OS X, Linux and\nWindows.\n\n### Docker\n\nUse the [Docker Image](https://hub.docker.com/r/csueiras/reinforcer):\n\n```\ndocker pull csueiras/reinforcer\n```\n\n### Homebrew\n\nInstall through [Homebrew](https://brew.sh/)\n\n```\nbrew tap csueiras/reinforcer \u0026\u0026 brew install reinforcer\n```\n\n#### Upgrading\n\n```\nbrew upgrade csueiras/reinforcer/reinforcer\n```\n\n## Usage\n\n### CLI\n\nGenerate reinforced code for all exported interfaces and structs:\n\n```\nreinforcer --src=./service.go --targetall --outputdir=./reinforced\n```\n\nGenerate reinforced code using regex:\n\n```\nreinforcer --src=./service.go --target='.*Service' --outputdir=./reinforced\n```\n\nGenerate reinforced code using an exact match:\n\n```\nreinforcer --src=./service.go --target=MyService --outputdir=./reinforced\n```\n\nFor more options:\n\n```\nreinforcer --help\n```\n\n```\nReinforcer is a CLI tool that generates code from interfaces that\nwill automatically inject middleware. Middlewares provide resiliency constructs\nsuch as circuit breaker, retries, timeouts, etc.\n\nUsage:\n  reinforcer [flags]\n\nFlags:\n      --config string      config file (default is $HOME/.reinforcer.yaml)\n  -d, --debug              enables debug logs\n  -h, --help               help for reinforcer\n  -i, --ignorenoret        ignores methods that don't return anything (they won't be wrapped in the middleware). By default they'll be wrapped in a middleware and if the middleware emits an error the call will panic.\n  -p, --outpkg string      name of generated package (default \"reinforced\")\n  -o, --outputdir string   directory to write the generated code to (default \"./reinforced\")\n  -q, --silent             disables logging. Mutually exclusive with the debug flag.\n  -s, --src strings        source files to scan for the target interface or struct. If unspecified the file pointed by the env variable GOFILE will be used.\n  -k, --srcpkg strings     source packages to scan for the target interface or struct.\n  -t, --target strings     name of target type or regex to match interface or struct names with\n  -a, --targetall          codegen for all exported interfaces/structs discovered. This option is mutually exclusive with the target option.\n  -v, --version            show reinforcer's version\n```\n\n### Using Reinforced Code\n\n1. Describe the target that you want to generate code for:\n\n```\ntype Client interface {\n\tDoOperation(ctx context.Context, arg string) error\n}\n```\n\nOr from a struct:\n\n```\ntype Client struct {\t\n}\n\nfunc (c *Client) DoOperation(ctx context.Context, arg string) error {\n    // ...\n    return nil\n}\n```\n\n2. Generate the reinforcer code:\n\n```\nreinforcer --debug --src='./client.go' --target=Client --outputdir=./reinforced\n```\n\n3. Create the runner/middleware factory with the middlewares you want to inject into the generated code:\n\n```\nr := runner.NewFactory(\n    metrics.NewMiddleware(...),\n    circuitbreaker.NewMiddleware(...),\n    bulkhead.NewMiddleware(...),\n    retry.NewMiddleware(...),\n    timeout.NewMiddleware(...),\n)\n```\n\n4. Optionally create your predicate for errors that shouldn't be retried\n\n```\n// shouldRetryErrPredicate is a predicate that ignores the \"NotFound\" errors emited by the DoOperation in Client. All other errors\n// are eligible for the middlewares.\nshouldRetryErrPredicate := func(method string, err error) bool {\n    if method == reinforced.ClientMethods.DoOperation \u0026\u0026 errors.Is(client.NotFound, err) {\n        return false\n    }\n    return true\n}\n```\n\n5. Wrap the \"real\"/unrealiable implementation in the generated code:\n\n```\nc := client.NewClient(...)\n\n// reinforcedClient implements the target interface so it can now be used in lieau of any place where the unreliable\n// client was used\nreinforcedClient := reinforced.NewClient(c, r, reinforced.WithRetryableErrorPredicate(shouldRetryErrPredicate))\n```\n\nA complete example is [here](./example/main.go) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsueiras%2Freinforcer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsueiras%2Freinforcer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsueiras%2Freinforcer/lists"}