go-ruby-marshal

Ruby's Marshal in pure Go โ€” byte-exact dump/load, no cgo.

pure Go ยท zero cgo Marshal v4.8 wire format MRI byte-exact dump / load Fixnum / Bignum split shortest-float symbol table object-link table shared objects & cycles Ruby-compatible
Documentation GitHub
Documentation (MkDocs Material + mike) License: BSD-3-Clause Go 1.26.4+ Coverage 100%

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 that go-embedded-ruby builds on โ€” 100% coverage, CI green across 6 arches.

marshal ready

The library: Marshal.dump / Marshal.load for Ruby’s binary serialization (wire format v4.8) over a typed value model โ€” Nil / Bool / Int / Float / Symbol / Str / Array / Hash. Byte-for-byte identical to MRI: the Fixnum/Bignum split, MRI’s shortest-float formatting, the symbol table, and the object-link table so shared objects and cycles round-trip.

A pure-Go, cgo-disabled implementation, so it cross-compiles and embeds anywhere. It reads and writes Marshal v4.8 byte-for-byte against MRI โ€” the integer encoding, shortest-float formatting, symbol table and object-link table that make shared objects and cycles round-trip โ€” over a small typed value model. It is a standalone, reusable module and the serialization member of the sibling family go-ruby-parser ยท go-ruby-regexp, consumed by github.com/go-embedded-ruby.