Ruby's Marshal in pure Go — byte-exact dump/load, no cgo.
🌐 Website · 📚 Documentation
go-ruby-marshal is a pure-Go (no cgo) implementation of Ruby's
Marshal binary
serialization — the format Marshal.dump and Marshal.load use to round-trip
Ruby objects. It speaks Marshal wire format v4.8 and is byte-for-byte
identical to MRI Ruby 4.0.5: it reproduces the Fixnum/Bignum split, MRI's
shortest-float formatting, the symbol table and the object-link
table, so shared objects and cycles serialize and round-trip exactly as
the reference interpreter does.
It is standalone and reusable over its own typed value model
(Nil / Bool / Int / Float / Symbol / Str / Array / Hash), and is
the serialization member of the go-ruby-* family — alongside
go-ruby-parser and
go-ruby-regexp — that
go-embedded-ruby builds on.
| Repo | What it is |
|---|---|
| marshal | the library: Marshal.dump / Marshal.load for the Ruby Marshal v4.8 wire format over a typed value model (Nil/Bool/Int/Float/Symbol/Str/Array/Hash), byte-exact against MRI |
- Pure Go, zero cgo. Cross-compiles and embeds anywhere; a static binary by default.
- MRI byte-exact. The integer encoding (Fixnum/Bignum split), shortest-float
formatting, symbol table and object-link table all match the reference
interpreter —
dumpoutput is identical andloadround-trips. - Shared objects & cycles. The object-link table makes references and cyclic structures serialize and reload faithfully.
- Standalone & reusable. No dependency on the Ruby runtime.
- 100% test coverage is the target, enforced as a CI gate, green across 6 arches.
A complete Marshal v4.8 codec — dump / load over the typed value model,
differential-tested against MRI Ruby 4.0.5 so output is byte-for-byte identical,
with the Fixnum/Bignum split, shortest-float formatting, symbol table and
object-link table (shared objects and cycles round-trip). 100% coverage, CI
green across 6 arches.
BSD-3-Clause.
