{"id":22680217,"url":"https://github.com/kostyay/protoc-gen-go-access-modifiers","last_synced_at":"2026-05-04T02:31:21.312Z","repository":{"id":189293606,"uuid":"621984438","full_name":"kostyay/protoc-gen-go-access-modifiers","owner":"kostyay","description":"This is a POC for a go protoc plugin that adds access modifiers to proto fields and methods","archived":false,"fork":false,"pushed_at":"2023-04-01T21:05:32.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T13:51:44.608Z","etag":null,"topics":["grpc","grpc-golang","protoc","protocol-buffers"],"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/kostyay.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}},"created_at":"2023-03-31T20:27:17.000Z","updated_at":"2024-11-28T08:38:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed9da061-a3b6-46c5-86ae-1d63e47b1943","html_url":"https://github.com/kostyay/protoc-gen-go-access-modifiers","commit_stats":null,"previous_names":["kostyay/protoc-gen-go-access-modifiers"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kostyay/protoc-gen-go-access-modifiers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostyay%2Fprotoc-gen-go-access-modifiers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostyay%2Fprotoc-gen-go-access-modifiers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostyay%2Fprotoc-gen-go-access-modifiers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostyay%2Fprotoc-gen-go-access-modifiers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kostyay","download_url":"https://codeload.github.com/kostyay/protoc-gen-go-access-modifiers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostyay%2Fprotoc-gen-go-access-modifiers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32592311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"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":["grpc","grpc-golang","protoc","protocol-buffers"],"created_at":"2024-12-09T19:12:44.642Z","updated_at":"2026-05-04T02:31:21.293Z","avatar_url":"https://github.com/kostyay.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"protoc-gen-go-access-modifiers\n======================\n\n__This is a proof of concept plugin__ for protoc that generates Go code.\n\nIt introduces the notion of access modifiers for message fields and methods.\n\nFor message fields it allows defining them as private and generates a `AsPublic()` method that empties the private fields into a public struct.\n\nIt is provided as a part of my blog post on gRPC API gateways.\n\nThis is not the final version of the plugin, but it is a good starting point for getting the idea how to use it.\n\nIn addition to the plugin you will find a gRPC client middleware strips private fields off incoming client responses.\n\n\n# Usage\n```bash\n    go install github.com/kostyay/protoc-gen-go-access-modifiers@latest\n```\n\nAdd to `buf.gen.yaml`:\n```yaml\n    plugins:\n      - name: protoc-gen-go-access-modifiers\n        out: .\n        opt: paths=source_relative\n```\n\nTo mark a field as private, add the `(access.v1.fo).private = true` option to the field:\n```proto\n    import \"access/v1/access.proto\";\n\n    message PrivateMessage {\n        string public_field = 1;\n        string private_field = 2 [(access.v1.fo).private = true];\n    }\n```\n\nTo mark a method as private, add the `(access.v1.mo).private = true` option to the method:\n```proto\n    import \"access/v1/access.proto\";\n\n    service PrivateService {\n        rpc PublicMethod(PublicRequest) returns (PublicResponse) {}\n        rpc PrivateMethod(PrivateRequest) returns (PrivateResponse) {\n            option (access.v1.mo).private = true;\n        }\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostyay%2Fprotoc-gen-go-access-modifiers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkostyay%2Fprotoc-gen-go-access-modifiers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostyay%2Fprotoc-gen-go-access-modifiers/lists"}