{"id":46929692,"url":"https://github.com/alta/protopatch","last_synced_at":"2026-03-11T04:12:05.405Z","repository":{"id":38094480,"uuid":"273104733","full_name":"alta/protopatch","owner":"alta","description":"protoc-gen-go patch utility","archived":false,"fork":false,"pushed_at":"2025-05-29T05:34:56.000Z","size":475,"stargazers_count":109,"open_issues_count":12,"forks_count":20,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-29T06:36:00.206Z","etag":null,"topics":["go","golang","protobuf","protoc","protocol-buffers","protos"],"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/alta.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2020-06-18T00:23:18.000Z","updated_at":"2025-05-29T05:34:59.000Z","dependencies_parsed_at":"2024-03-23T06:24:16.406Z","dependency_job_id":"57adb04b-bd9c-4bf1-bd60-f5c04a3b2d66","html_url":"https://github.com/alta/protopatch","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/alta/protopatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alta%2Fprotopatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alta%2Fprotopatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alta%2Fprotopatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alta%2Fprotopatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alta","download_url":"https://codeload.github.com/alta/protopatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alta%2Fprotopatch/sbom","scorecard":{"id":187013,"data":{"date":"2025-08-11","repo":{"name":"github.com/alta/protopatch","commit":"4822ad5656b4dee77402c426b2a91a8b614347ce"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Maintained","score":0,"reason":"1 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":"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":"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":"Code-Review","score":0,"reason":"Found 0/4 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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yaml: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":"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.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/alta/protopatch/go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/alta/protopatch/go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yaml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/alta/protopatch/go.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/alta/protopatch/go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yaml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/alta/protopatch/go.yaml/main?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":"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":-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 30 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":7,"reason":"3 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"],"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-16T19:58:01.822Z","repository_id":38094480,"created_at":"2025-08-16T19:58:01.822Z","updated_at":"2025-08-16T19:58:01.822Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30370675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","golang","protobuf","protoc","protocol-buffers","protos"],"created_at":"2026-03-11T04:12:05.196Z","updated_at":"2026-03-11T04:12:05.395Z","avatar_url":"https://github.com/alta.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protopatch\n\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/alta/protopatch) [![build status](https://img.shields.io/github/actions/workflow/status/alta/protopatch/go.yaml.svg?branch=main)](https://github.com/alta/protopatch/actions)\n\nPatch `protoc` plugin output with Go-specific features. The `protoc-gen-go-patch` command wraps calls to Go code generators like [`protoc-gen-go`](https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go) or [`protoc-gen-go-grpc`](https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc) and patches the Go syntax before being written to disk.\n\n## Install\n\n`go install github.com/alta/protopatch/cmd/protoc-gen-go-patch`\n\n## Usage\n\nAfter installing `protoc-gen-go-patch`, use it by specifying it with a `--go-patch_out=...` argument to `protoc`:\n\n```shell\nprotoc \\\n\t-I . \\\n\t-I `go list -m -f {{.Dir}} github.com/alta/protopatch` \\\n\t-I `go list -m -f {{.Dir}} google.golang.org/protobuf` \\\n\t--go-patch_out=plugin=go,paths=source_relative:. \\\n\t--go-patch_out=plugin=go-grpc,paths=source_relative:. \\\n\t*.proto\n```\n\n## Features\n\nPatches are defined via an `Options` extension on messages, fields, `oneof` fields, enums, and enum values.\n\n- `go.message` — message options, which modify the generated Go struct for a message.\n- `go.field` — message field options, which modify Go struct fields and getter methods.\n- `go.oneof` — oneof field options, which modify struct fields, interface types, and wrapper types.\n- `go.enum` — enum options, which modify Go enum types and values.\n- `go.value` — enum value options, which modify Go const values.\n\n### Custom Names\n\n```proto\nimport \"patch/go.proto\";\n\nmessage OldName {\n\toption (go.message).name = 'NewName';\n\tint id = 1 [(go.field).name = 'ID'];\n}\n\nenum Error {\n\toption (go.enum).name = 'ProtocolError';\n\tINVALID = 1 [(go.value).name = 'ErrInvalid'];\n\tNOT_FOUND = 2 [(go.value).name = 'ErrNotFound'];\n\tTOO_FUN = 3 [(go.value).name = 'ErrTooFun'];\n}\n```\n\n#### Alternate Syntax\n\nMultiple options can be grouped together with a message bounded by `{}`:\n\n```proto\nimport \"patch/go.proto\";\n\nmessage OldName {\n\toption (go.message) = {name: 'NewName'};\n\tint32 id = 1 [(go.field) = {name: 'ID'}];\n}\n\nenum Error {\n\toption (go.enum) = {name: 'ProtocolError'};\n\tINVALID = 1 [(go.value) = {name: 'ErrInvalid'}];\n\tNOT_FOUND = 2 [(go.value) = {name: 'ErrNotFound'}];\n\tTOO_FUN = 3 [(go.value) = {name: 'ErrTooFun'}];\n}\n```\n\n### Struct Tags\n\n```proto\nmessage ToDo {\n\tint32 id = 1 [(go.field).name: 'ID', (go.field).tags = 'xml:\"id,attr\"'];\n\tstring description = 2 [(go.field).tags: 'xml:\"desc\"'];\n}\n```\n\n#### Alternate Syntax\n\nMultiple options can be grouped together with a message bounded by `{}`:\n\n```proto\nmessage ToDo {\n\tint32 id = 1 [(go.field) = {name: 'ID', tags: 'xml:\"id,attr\"'}];\n\tstring description = 2 [(go.field) = {tags: 'xml:\"desc\"'}];\n}\n```\n\n### Embedded Fields\n\nA message field can be embedded in the generated [Go struct](https://golang.org/ref/spec#Struct_types) with the `(go.field).embed` option. This only works for message fields, and will not work for oneof fields or basic types.\n\n```proto\nimport \"patch/go.proto\";\n\nmessage A {\n\tB b = 1 [(go.field).embed = true];\n}\n\nmessage B {\n\tstring value = 1;\n}\n```\n\nThe resulting Go struct will partially have the form:\n\n```go\ntype A struct {\n\t*B\n}\n\ntype B struct {\n\tValue string\n}\n\nvar a A\na.Value = \"value\" // This works because B is embedded in A\n```\n\n#### Alternate Syntax\n\nMultiple options can be grouped together with a message bounded by `{}`:\n\n```proto\nimport \"patch/go.proto\";\n\nmessage A {\n\tB b = 1 [(go.field) = {embed: true}];\n}\n\nmessage B {\n\tstring value = 1;\n}\n```\n\n### Linting\n\nProtopatch can automatically “lint” generated names into something resembling [idiomatic Go style](https://golang.org/doc/effective_go.html#names). This feature should be considered *unstable*, and the names it generates are subject to change as this feature evolves.\n\n- **Initialisms:** names with `ID` or `URL` or other well-known initialisms will have their case preserved. For example `Id` would lint to `ID`, and `ApiBaseUrl` would lint to `APIBaseURL`.\n- **Stuttering:** it will attempt to remove repeated prefixed names from enum values. An enum value of type `Foo` named `Foo_FOO_BAR` would lint to `FooBar`.\n\nTo lint all generated Go names, add `option (go.lint).all = true` to your `proto` file. To lint only enum values, add `option (go.lint).values = true`. To specify one or more custom initialisms, specify an initialism with `option (go.lint).initialisms = 'HSV'` for the `HSV` initialism. All names with `HSV` will preserve its case.\n\n```proto\noption (go.lint).all = true;\noption (go.lint).initialisms = 'RGB';\noption (go.lint).initialisms = 'RGBA';\noption (go.lint).initialisms = 'HSV';\n\nenum Protocol {\n\t// PROTOCOL_INVALID value should lint to ProtocolInvalid.\n\tPROTOCOL_INVALID = 0;\n\t// PROTOCOL_IP value should lint to ProtocolIP.\n\tPROTOCOL_IP = 1;\n\t// PROTOCOL_UDP value should lint to ProtocolUDP.\n\tPROTOCOL_UDP = 2;\n\t// PROTOCOL_TCP value should lint to ProtocolTCP.\n\tPROTOCOL_TCP = 3;\n}\n\nmessage Color {\n\toneof value {\n\t\t// rgb should lint to RGB.\n\t\tstring rgb = 1;\n\t\t// rgba should lint to RGBA.\n\t\tstring rgba = 2;\n\t\t// hsv should lint to HSV.\n\t\tstring hsv = 3;\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falta%2Fprotopatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falta%2Fprotopatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falta%2Fprotopatch/lists"}