6 "github.com/vmihailenco/msgpack"
7 "github.com/zclconf/go-cty/cty"
10 type dynamicVal struct {
15 func (dv *dynamicVal) MarshalMsgpack() ([]byte, error) {
16 // Rather than defining a msgpack-specific serialization of types,
17 // instead we use the existing JSON serialization.
18 typeJSON, err := dv.Value.Type().MarshalJSON()
20 return nil, dv.Path.NewErrorf("failed to serialize type: %s", err)
23 enc := msgpack.NewEncoder(&buf)
25 enc.EncodeBytes(typeJSON)
26 err = marshal(dv.Value, dv.Value.Type(), dv.Path, enc)
30 return buf.Bytes(), nil