---
source: https://iinventedlight.com/library/notes/go-encoding-gob.md
title: "Go encoding/gob: self-describing binary values"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (Go); BSD-3-Clause (Go); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Go, encoding/gob package reference; Go, encoding/gob source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-encoding-gob"
tags: [go, gob, encoding, rpc, binary]
client: Librarian
sources:
  - id: S1
    title: "encoding/gob package reference"
    publisher: Go
    url: https://pkg.go.dev/encoding/gob
    accessed: 2026-11-23
    license: "BSD-3-Clause"
  - id: S2
    title: "encoding/gob source"
    publisher: Go
    url: https://go.dev/src/encoding/gob/doc.go
    accessed: 2026-11-23
    license: "BSD-3-Clause"
---
# Go encoding/gob: self-describing binary values
**Answer:** This package moves self-describing binary values, called gobs, between a transmitter and a receiver.

## Streams of gobs

The transmitter is an Encoder; the receiver is a Decoder.

A common use is carrying arguments and results for remote procedure calls.

Each item is preceded by a type specification, so the stream describes itself.

Those types are expressed with a small set of predefined types.

## Pointers and recursion

A pointer is not sent; the value it points to is sent instead.

That is, the values are flattened.

A nil pointer is rejected, because it has no value to send.

Recursive types are fine, but cyclic data is problematic.

## See also

- [go-encoding-json](https://iinventedlight.com/library/notes/go-encoding-json/)
- [go-encoding-binary](https://iinventedlight.com/library/notes/go-encoding-binary/)
- [go-encoding-xml](https://iinventedlight.com/library/notes/go-encoding-xml/)

## Claims

- id: C1
  claim: Gobs are binary values exchanged between an Encoder and a Decoder.
  source: S1
  evidence: "binary values exchanged between an Encoder"

- id: C2
  claim: A gob stream is self-describing.
  source: S1
  evidence: "A stream of gobs is self-describing."

- id: C3
  claim: Pointers themselves are not sent; the pointed-to values are.
  source: S2
  evidence: "Pointers are not transmitted, but the things they point to are"

- id: C4
  claim: Nil pointers are not permitted.
  source: S2
  evidence: "Nil pointers are not permitted,"

## Sources

- [S1] encoding/gob package reference. Go. https://pkg.go.dev/encoding/gob . License: BSD-3-Clause. Accessed 2026-11-23.

- [S2] encoding/gob source. Go. https://go.dev/src/encoding/gob/doc.go . License: BSD-3-Clause. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, encoding/gob package reference; Go, encoding/gob source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
