polydawn / refmt

Object mapping for golang.
MIT License
48 stars 14 forks source link

Things fail with weird errors if your atlas doesnt know about all your types #14

Open whyrusleeping opened 6 years ago

whyrusleeping commented 6 years ago

I had a type that looked something like:

type A struct {
  Foo []B
}

type B struct {
  Cats uint64
  ParrotQuote string
  DungHeap Heap
}

type Heap struct {
  // heap related fields
}

And I only made an atlas entry for A. When marshaling an instance of A however, it failed with cryptic messages such as "value already consumed". I finally figured out that making atlas entries for B and Heap made things happier, but it took me a while.