{"id":13412971,"url":"https://github.com/hexdigest/gowrap","last_synced_at":"2026-01-14T18:48:52.980Z","repository":{"id":33451815,"uuid":"148887586","full_name":"hexdigest/gowrap","owner":"hexdigest","description":"GoWrap is a command line tool for generating decorators for Go interfaces","archived":false,"fork":false,"pushed_at":"2025-11-20T01:55:56.000Z","size":6633,"stargazers_count":1289,"open_issues_count":22,"forks_count":94,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-11-30T05:15:16.504Z","etag":null,"topics":["code-generation","decorators","fallback","go","golang","golang-tools","interface","interfaces","logrus","prometheus","prometheus-metrics"],"latest_commit_sha":null,"homepage":null,"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/hexdigest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"patreon":"hexdigest"}},"created_at":"2018-09-15T09:20:42.000Z","updated_at":"2025-11-29T16:26:00.000Z","dependencies_parsed_at":"2023-12-18T01:01:11.055Z","dependency_job_id":"8eef1022-5715-4a8d-a1ef-957f9b93b28b","html_url":"https://github.com/hexdigest/gowrap","commit_stats":{"total_commits":142,"total_committers":33,"mean_commits":4.303030303030303,"dds":0.4436619718309859,"last_synced_commit":"fb0962534d50a5f37a68f3a8d4964ee3113d03c6"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/hexdigest/gowrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdigest%2Fgowrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdigest%2Fgowrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdigest%2Fgowrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdigest%2Fgowrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexdigest","download_url":"https://codeload.github.com/hexdigest/gowrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdigest%2Fgowrap/sbom","scorecard":{"id":462831,"data":{"date":"2025-08-11","repo":{"name":"github.com/hexdigest/gowrap","commit":"418804c744e5fb6abb7ce35f7fec9d14d0a7df29"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Maintained","score":4,"reason":"5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"Code-Review","score":8,"reason":"Found 5/6 approved changesets -- score normalized to 8","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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Warn: topLevel 'contents' permission set to 'write': .github/workflows/release.yaml:7","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":"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":"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/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/hexdigest/gowrap/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/hexdigest/gowrap/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/hexdigest/gowrap/release.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/hexdigest/gowrap/release.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/hexdigest/gowrap/release.yaml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction 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":"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yaml:9"],"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":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.4.2 not signed: https://api.github.com/repos/hexdigest/gowrap/releases/200166649","Warn: release artifact v1.4.1 not signed: https://api.github.com/repos/hexdigest/gowrap/releases/190322171","Warn: release artifact v1.4.0 not signed: https://api.github.com/repos/hexdigest/gowrap/releases/171850468","Warn: release artifact v1.3.10 not signed: https://api.github.com/repos/hexdigest/gowrap/releases/161894234","Warn: release artifact v1.3.7 not signed: https://api.github.com/repos/hexdigest/gowrap/releases/153920636","Warn: release artifact v1.4.2 does not have provenance: https://api.github.com/repos/hexdigest/gowrap/releases/200166649","Warn: release artifact v1.4.1 does not have provenance: https://api.github.com/repos/hexdigest/gowrap/releases/190322171","Warn: release artifact v1.4.0 does not have provenance: https://api.github.com/repos/hexdigest/gowrap/releases/171850468","Warn: release artifact v1.3.10 does not have provenance: https://api.github.com/repos/hexdigest/gowrap/releases/161894234","Warn: release artifact v1.3.7 does not have provenance: https://api.github.com/repos/hexdigest/gowrap/releases/153920636"],"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 'master'"],"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 29 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":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw","Warn: Project is vulnerable to: GO-2025-3787 / GHSA-fv92-fjc5-jj9h"],"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-19T11:36:45.730Z","repository_id":33451815,"created_at":"2025-08-19T11:36:45.730Z","updated_at":"2025-08-19T11:36:45.730Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["code-generation","decorators","fallback","go","golang","golang-tools","interface","interfaces","logrus","prometheus","prometheus-metrics"],"created_at":"2024-07-30T20:01:31.755Z","updated_at":"2026-01-14T18:48:52.964Z","avatar_url":"https://github.com/hexdigest.png","language":"Go","readme":"# GoWrap\n[![License](https://img.shields.io/badge/license-mit-green.svg)](https://github.com/hexdigest/gowrap/blob/master/LICENSE)\n[![Build](https://github.com/hexdigest/gowrap/actions/workflows/go.yml/badge.svg)](https://github.com/hexdigest/gowrap/actions/workflows/go.yml)\n[![Coverage Status](https://coveralls.io/repos/github/hexdigest/gowrap/badge.svg?branch=master)](https://coveralls.io/github/hexdigest/gowrap?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hexdigest/gowrap?dropcache)](https://goreportcard.com/report/github.com/hexdigest/gowrap)\n[![GoDoc](https://godoc.org/github.com/hexdigest/gowrap?status.svg)](http://godoc.org/github.com/hexdigest/gowrap)\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go#generation-and-generics)\n[![Release](https://img.shields.io/github/release/hexdigest/gowrap.svg)](https://github.com/hexdigest/gowrap/releases/latest)\n\nGoWrap is a command line tool that generates decorators for Go interface types using simple templates.\nWith GoWrap you can easily add metrics, tracing, fallbacks, pools, and many other features into your existing code in a few seconds.\n\n\n## Demo\n\n![demo](https://github.com/hexdigest/gowrap/blob/master/gowrap.gif)\n\n## Installation\n### CLI\n```\ngo install github.com/hexdigest/gowrap/cmd/gowrap@latest\n```\n### As module\n```\ngo get -u github.com/hexdigest/gowrap/cmd/gowrap\n```\n\n## Usage of gowrap\n\n```\nUsage: gowrap gen -p package -i interfaceName -t template -o output_file.go\n  -g\tdon't put //go:generate instruction into the generated code\n  -i string\n    \tthe source interface name, i.e. \"Reader\"\n  -o string\n    \tthe output file name\n  -p string\n    \tthe source package import path, i.e. \"io\", \"github.com/hexdigest/gowrap\" or\n    \ta relative import path like \"./generator\"\n  -t template\n    \tthe template to use, it can be an HTTPS URL a local file or a\n    \treference to one of the templates in the gowrap repository\n  -v value\n    \ta key-value pair to parametrize the template,\n    \targuments without an equal sign are treated as a bool values,\n    \ti.e. -v DecoratorName=MyDecorator -v disableChecks\n```\n\nThis will generate an implementation of the io.Reader interface wrapped with prometheus metrics\n\n```\n  $ gowrap gen -p io -i Reader -t prometheus -o reader_with_metrics.go\n```\n\nThis will generate a fallback decorator for the Connector interface that can be found in the ./connector subpackage:\n\n```\n  $ gowrap gen -p ./connector -i Connector -t fallback -o ./connector/with_metrics.go\n```\n\nRun `gowrap help` for more options\n\n## Hosted templates\n\nWhen you specify a template with the \"-t\" flag, gowrap will first search for and use the local file with this name.\nIf the file is not found, gowrap will look for the template [here](https://github.com/hexdigest/gowrap/tree/master/templates) and use it if found.\n\nList of available templates:\n  - [circuitbreaker](https://github.com/hexdigest/gowrap/tree/master/templates/circuitbreaker) stops executing methods of the wrapped interface after the specified number of consecutive errors and resumes execution after the specified delay\n  - [fallback](https://github.com/hexdigest/gowrap/tree/master/templates/fallback) takes several implementations of the source interface and concurrently runs each implementation if the previous attempt didn't return the result in a specified period of time, it returns the first non-error result\n  - [log](https://github.com/hexdigest/gowrap/tree/master/templates/log) instruments the source interface with logging using standard logger from the \"log\" package\n  - [logrus](https://github.com/hexdigest/gowrap/tree/master/templates/logrus) instruments the source interface with logging using popular [sirupsen/logrus](https://github.com/sirupsen/logrus) logger\n  - [opencensus](https://github.com/hexdigest/gowrap/tree/master/templates/opencensus) instruments the source interface with opencensus spans\n  - [opentelemetry](https://github.com/hexdigest/gowrap/tree/master/templates/opentelemetry) instruments the source interface with opentelemetry spans\n  - [opentracing](https://github.com/hexdigest/gowrap/tree/master/templates/opentracing) instruments the source interface with opentracing spans\n  - [prometheus](https://github.com/hexdigest/gowrap/tree/master/templates/prometheus) instruments the source interface with prometheus metrics\n  - [ratelimit](https://github.com/hexdigest/gowrap/tree/master/templates/ratelimit) instruments the source interface with RPS limit and concurrent calls limit\n  - [retry](https://github.com/hexdigest/gowrap/tree/master/templates/retry) instruments the source interface with retries\n  - [robinpool](https://github.com/hexdigest/gowrap/tree/master/templates/robinpool) puts several implementations of the source interface to the slice and for every method call it picks one implementation from the slice using the Round-robin algorithm\n  - [syncpool](https://github.com/hexdigest/gowrap/tree/master/templates/syncpool) puts several implementations of the source interface to the sync.Pool and for every method call it gets one implementation from the pool and puts it back once finished\n  - [timeout](https://github.com/hexdigest/gowrap/tree/master/templates/timeout) instruments each method that accepts context with configurable timeout\n  - [validate](https://github.com/hexdigest/gowrap/tree/master/templates/validate) runs `func Validate() error` method on each argument if it's present\n  - [twirp\\_error](https://github.com/hexdigest/gowrap/tree/master/templates/twirp_error) inject request data into twirp.Error as metadata\n  - [twirp\\_validate](https://github.com/hexdigest/gowrap/tree/master/templates/twirp_validate) runs `func Validate() error` method on each argument if it's present and wraps returned error with twirp.Malformed error\n  - [grpc\\_validate](https://github.com/hexdigest/gowrap/tree/master/templates/grpc_validate) runs `func Validate() error` method on each argument if it's present and returns [InvalidArgument](https://github.com/grpc/grpc-go/blob/9d8d97a245af2d4bc743585418e1b4aebada0637/codes/codes.go#L49) error in case when validation failed\n  - [elastic apm](https://github.com/hexdigest/gowrap/tree/master/templates/elasticapm) instruments the source interface with elastic apm spans\n\nBy default GoWrap places the `//go:generate` instruction into the generated code. \nThis allows you to regenerate decorators' code just by typing `go generate ./...` when you change the source interface type declaration.\nHowever if you used a remote template, the `//go:generate` instruction will contain the HTTPS URL of the template and therefore\nyou will need to have internet connection in order to regenerate decorators. In order to avoid this, you can copy templates from the GoWrap repository \nto local files and add them to your version control system:\n```\n$ gowrap template copy fallback templates/fallback\n```\n\nThe above command will fetch the fallback template and copy it to the templates/fallback local file.\nAfter template is copied, you can generate decorators using this local template:\n\n```\n$ gowrap gen -p io -i Reader -t templates/fallback reader_with_fallback.go\n```\n\n## Custom templates\n\nYou can always write your own template that will provide the desired functionality to your interfaces.\nIf you think that your template might be useful to others, please consider adding it to our [template repository](https://github.com/hexdigest/gowrap/tree/master/templates).\n\nThe structure of information passed to templates is documented with the [TemplateInputs](https://godoc.org/github.com/hexdigest/gowrap/generator#TemplateInputs) struct.\n\n### Template Functions\n\nIn the templates, all functions provided by the [sprig](http://masterminds.github.io/sprig/) template library are available.\n\nAdditionally `gowrap` includes the following template functions:\n\n- `up`: returns the input with all Unicode letters mapped to their upper case.\n- `down`: returns the input with all Unicode letters mapped to their lower case.\n- `upFirst`: returns the input with the first Unicode letter mapped to their upper case.\n- `downFirst`: returns the input with the first Unicode letter mapped to their lower case.\n- `replace`: returns the input with all occurences of the first argument replaced with the second argument.\n- `snake`: returns the input in snake case representation.\n\n## Become a patron\n\nHere's my [Patreon page](https://www.patreon.com/hexdigest). Thank you!\n","funding_links":["https://patreon.com/hexdigest","https://www.patreon.com/hexdigest"],"categories":["发电机","Generation and Generics","Go","Generators","代码生成与泛型","Relational Databases"],"sub_categories":["检索及分析资料库","Advanced Console UIs","Search and Analytic Databases","SQL 查询语句构建库","Utility/Miscellaneous"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdigest%2Fgowrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexdigest%2Fgowrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdigest%2Fgowrap/lists"}