Binary / byte utilities for Go.
Currently this package is just a wrapper around the encoding/gob package, with hooks for dependency injection.
type Foo struct {
Value int
}
foo := &Foo{10}
bytes, err := binu.ToGob(foo)
// if err etc
newFoo := new(Foo)
err = binu.FromGob(bytes, newFoo)
// if err etc
// newFoo.Value == foo.Value
If you'd prefer to use dependency injection:
func Serialize(gobber binu.Gobber) error {
err := gobber.To(value)
// etc
}