{"id":16092317,"url":"https://github.com/alecthomas/go-rpcgen","last_synced_at":"2025-08-07T21:11:26.522Z","repository":{"id":66600198,"uuid":"4872498","full_name":"alecthomas/go-rpcgen","owner":"alecthomas","description":"Generates Go RPC server and client boilerplate for interfaces.","archived":false,"fork":false,"pushed_at":"2023-12-02T01:44:00.000Z","size":14,"stargazers_count":17,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-31T02:43:59.837Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecthomas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2012-07-03T13:25:55.000Z","updated_at":"2021-07-22T16:34:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"e05b727f-b846-409d-8f4f-a307edef8168","html_url":"https://github.com/alecthomas/go-rpcgen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alecthomas/go-rpcgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-rpcgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-rpcgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-rpcgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-rpcgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecthomas","download_url":"https://codeload.github.com/alecthomas/go-rpcgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-rpcgen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269324717,"owners_count":24398045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"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":[],"created_at":"2024-10-09T16:06:59.810Z","updated_at":"2025-08-07T21:11:26.484Z","avatar_url":"https://github.com/alecthomas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generates RPC server and client stubs for Go\n\nThis utility generates server and client RPC stubs from a Go interface. These\nstubs eliminate a large amount of the boilerplate code required for creating\nconvenient, clean RPC interfaces.\n\n## Installing\n\nThe usual `go` command should install `go-rpcgen`:\n\n    $ go get github.com/alecthomas/go-rpcgen\n\n## Limitations\n\nThe source type must:\n\n1. Be an `interface` (`struct`s are not currently supported).\n2. Name all of its return values.\n3. Return an `error` as the last value in its return type.\n\n## Generating the stubs\n\nIf you had a file `arith.go` containing this interface:\n\n    package arith\n\n    type Arith interface {\n  \t  Add(a, b int) (result int, err error)\n    }\n\nThe following command will generate stubs for the interface:\n\n    go-rpcgen --source=arith.go --type=Arith\n\nThat will generate a file named `arithrpc.go` (by default) containing two\ntypes, `ArithService` and `ArithClient`, that can be used with the Go RPC\nsystem, and as a client for the system, respectively.\n\nThe generated code will look something like this:\n\n    package arith\n    \n    import (\n    \t\"net/rpc\"\n    )\n    \n    type ArithService struct {\n    \timpl Arith\n    }\n    \n    func NewArithService(impl Arith) *ArithService {\n    \treturn \u0026ArithService{impl}\n    }\n    \n    type AddRequest struct {\n    \tA, B int\n    }\n    \n    type AddResponse struct {\n    \tResult int\n    }\n    \n    func (s *ArithService) Add(request *AddRequest, response *AddResponse) (err error) {\n    \tresponse.Result, err = s.impl.Add(request.A, request.B)\n    \treturn\n    }\n    \n    type ArithClient struct {\n    \tclient *rpc.Client\n    \tservice string\n    }\n    \n    func NewArithClient(client *rpc.Client, service string) *ArithClient {\n    \treturn \u0026ArithClient{client, service}\n    }\n    \n    func (_c *ArithClient) Add(a, b int) (result int, err error) {\n    \trequest := \u0026AddRequest{a, b}\n    \tresponse := \u0026AddResponse{}\n    \terr = _c.client.Call(_c.service + \".Add\", request, response)\n    \treturn response.Result, err\n    }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fgo-rpcgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecthomas%2Fgo-rpcgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fgo-rpcgen/lists"}