{"id":15074491,"url":"https://github.com/alexandrevilain/protoc-gen-moq","last_synced_at":"2026-02-10T03:33:20.339Z","repository":{"id":57645424,"uuid":"441171670","full_name":"alexandrevilain/protoc-gen-moq","owner":"alexandrevilain","description":"protoc plugin which generates client structs mocks","archived":false,"fork":false,"pushed_at":"2022-11-01T13:12:25.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T10:41:42.545Z","etag":null,"topics":["golang","grpc","mock","protobuf","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/alexandrevilain.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-12-23T12:20:29.000Z","updated_at":"2023-03-04T05:40:32.000Z","dependencies_parsed_at":"2022-09-08T15:11:31.745Z","dependency_job_id":null,"html_url":"https://github.com/alexandrevilain/protoc-gen-moq","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/alexandrevilain/protoc-gen-moq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrevilain%2Fprotoc-gen-moq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrevilain%2Fprotoc-gen-moq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrevilain%2Fprotoc-gen-moq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrevilain%2Fprotoc-gen-moq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexandrevilain","download_url":"https://codeload.github.com/alexandrevilain/protoc-gen-moq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrevilain%2Fprotoc-gen-moq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29289908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T02:32:08.756Z","status":"ssl_error","status_checked_at":"2026-02-10T02:30:31.937Z","response_time":65,"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":["golang","grpc","mock","protobuf","protocol-buffers"],"created_at":"2024-09-25T03:33:48.056Z","updated_at":"2026-02-10T03:33:20.298Z","avatar_url":"https://github.com/alexandrevilain.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protoc-gen-moq\n\nprotoc-gen-moq is a plugin of the Google protocol buffers compiler protoc. It reads protobuf service definitions and generates a mocked service client structs.\nIt generates its mocked struct using the [matryer/moq](https://github.com/matryer/moq) template.\n\n## How to use it ?\n\nYou first need to install the plugin by placing it in your `$PATH`:\n```bash\n$ go install github.com/alexandrevilain/protoc-gen-moq@latest\n```\n\nMake sure that your `$GOBIN` is in your `$PATH`.\n\nThen run it with protoc alongside the protoc-gen-go-grpc plugin:\n```bash\n$ protoc \\\n\t--go_out=. \\\n\t--go_opt=paths=source_relative \\\n\t--go-grpc_out=. \\\n\t--go-grpc_opt=paths=source_relative \\\n\t--moq_out=. \\\n\t--moq_opt=paths=source_relative \\\n   \thello.proto\n```\n\n## Running tests\n\nTo run both unit and conformance tests run:\n\n```bash\n$ make test\n```\n\n## Why not using the template package of github.com/matryer/moq ?\n\nI can't use the template package from [moq](https://github.com/matryer/moq) for two reasons:\n- the `template` package is inside the `internal` package which prevents external usage of the code inside.\n- the `template` package makes an extensive usage of `go/types` which is not used by protogen.\n\nTo ensure the 100% compatibility between struct generated by protoc-gen-moq and moq I created conformance tests which generate the mock for [https://github.com/grpc/grpc-go/blob/master/test/grpc_testing/test.proto](https://github.com/grpc/grpc-go/blob/master/test/grpc_testing/test.proto). The rendered moq file is then checked using go vet which will report an error if the generated struct does not implement the interface methods.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandrevilain%2Fprotoc-gen-moq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandrevilain%2Fprotoc-gen-moq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandrevilain%2Fprotoc-gen-moq/lists"}