Go net/rpc: call exported methods across a network connection
Answer: Package rpc provides access to the exported methods of an object across a network.
A frozen service model
This package is frozen: it takes no new features.
Registering an object publishes a service whose name is the object's type.
Once registered, the object's exported methods can be reached remotely.
Two objects of the same type cannot both be registered.
Methods, codecs, and clients
Only methods that satisfy these criteria will be made available for remote access.
A non-nil error return means the reply is not sent back to the client.
Unless a codec is set up explicitly, encoding/gob is used to transport the data.
The convenience functions Dial and DialHTTP perform both steps for a connection.
See also
Claims
- id: C1 claim: The package is frozen and takes no new features. source: S1 evidence: "is frozen and is not accepting new features"
- id: C2 claim: After registration, exported methods are reachable remotely. source: S1 evidence: "exported methods of the object will be accessible remotely"
- id: C3 claim: By default, encoding/gob transports the data. source: S1 evidence: "package encoding/gob is used to transport the data"
- id: C4 claim: The source comment also says the package is frozen. source: S2 evidence: "is frozen and is not accepting new features"
Sources
- [S1] net/rpc. The Go Authors. https://pkg.go.dev/net/rpc . License: BSD-3-Clause. Accessed 2026-11-26.
- [S2] net/rpc source. The Go Authors. https://go.dev/src/net/rpc/server.go . License: BSD-3-Clause. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, net/rpc; The Go Authors, net/rpc source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, net/rpc; The Go Authors, net/rpc source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go net/rpc: call exported methods across a network connection." iinventedlight Library, iil:note:98qppeh2, version of 2026-11-26. https://iinventedlight.com/library/notes/go-net-rpc/. License: CC-BY-4.0.
@misc{iil_note_98qppeh2,
author = {{iinventedlight}},
title = {{Go net/rpc: call exported methods across a network connection}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/go-net-rpc/},
note = {Permanent ID iil:note:98qppeh2. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-net-rpc.schema.json (schema; CC-BY-4.0)
- go-net-rpc.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-net-rpc.md.